From f732616f8be8b2c8b4137108faa25eeaccb77499 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sun, 1 Jun 2008 14:20:02 +0200 Subject: [PATCH 1/1] Replace para_ prefix by adu_. --- adu.c | 32 ++++++++++++++++---------------- adu.h | 4 ++-- fd.c | 8 ++++---- fd.h | 8 ++++---- string.c | 14 +++++++------- string.h | 10 +++++----- 6 files changed, 38 insertions(+), 38 deletions(-) diff --git a/adu.c b/adu.c index 54af136..97d55e1 100644 --- a/adu.c +++ b/adu.c @@ -75,7 +75,7 @@ static inline int check_uid_arg(const char *arg, uint32_t *uid) * returns a signed value. */ int64_t val; - int ret = para_atoi64(arg, &val); + int ret = atoi64(arg, &val); if (ret < 0) return ret; @@ -88,7 +88,7 @@ static inline int check_uid_arg(const char *arg, uint32_t *uid) static int parse_uid_range(const char *orig_arg, struct uid_range *ur) { int ret; - char *arg = para_strdup(orig_arg), *p = strchr(arg, '-'); + char *arg = adu_strdup(orig_arg), *p = strchr(arg, '-'); if (!p || p == arg) { /* -42 or 42 */ ret = check_uid_arg(p? p + 1 : arg, &ur->high); @@ -320,11 +320,11 @@ static int open_user_table(struct user_info *ui, int create) { int ret; - ui->desc = para_malloc(sizeof(*ui->desc)); + ui->desc = adu_malloc(sizeof(*ui->desc)); ui->desc->num_columns = NUM_UT_COLUMNS; ui->desc->flags = 0; ui->desc->column_descriptions = user_table_cols; - ui->desc->dir = para_strdup(conf.database_dir_arg); + ui->desc->dir = adu_strdup(conf.database_dir_arg); ui->desc->name = make_message("%u", (unsigned)ui->uid); INFO_LOG(".............................uid #%u: %u\n", (unsigned)num_uids, (unsigned)ui->uid); @@ -357,7 +357,7 @@ static uint32_t uid_hash_table_size = 1 << uid_hash_bits; static void create_hash_table(void) { - uid_hash_table = para_calloc(uid_hash_table_size + uid_hash_table = adu_calloc(uid_hash_table_size * sizeof(struct user_info)); } @@ -371,7 +371,7 @@ static int create_tables(void) { int ret; - dir_table_desc.dir = para_strdup(conf.database_dir_arg); + dir_table_desc.dir = adu_strdup(conf.database_dir_arg); ret = osl(osl_create_table(&dir_table_desc)); if (ret < 0) return ret; @@ -576,7 +576,7 @@ static uint64_t num_dirs; static uint64_t num_files; static uint64_t num_bytes; -int scan_dir(char *dirname, uint64_t *parent_dir_num) +static int scan_dir(char *dirname, uint64_t *parent_dir_num) { DIR *dir; struct dirent *entry; @@ -586,7 +586,7 @@ int scan_dir(char *dirname, uint64_t *parent_dir_num) check_signals(); DEBUG_LOG("----------------- %llu: %s\n", (long long unsigned)num_dirs, dirname); - ret = para_opendir(dirname, &dir, &cwd_fd); + ret = adu_opendir(dirname, &dir, &cwd_fd); if (ret < 0) { if (ret != -ERRNO_TO_ERROR(EACCES)) return ret; @@ -638,7 +638,7 @@ int scan_dir(char *dirname, uint64_t *parent_dir_num) &dir_size, &dir_files); out: closedir(dir); - ret2 = para_fchdir(cwd_fd); + ret2 = adu_fchdir(cwd_fd); if (ret2 < 0 && ret >= 0) ret = ret2; close(cwd_fd); @@ -665,7 +665,7 @@ again: free(result); result = tmp; } else - result = para_strdup((char *)obj.data); + result = adu_strdup((char *)obj.data); ret = osl(osl_get_object(dir_table, row, DT_PARENT_NUM, &obj)); if (ret < 0) goto out; @@ -691,7 +691,7 @@ static int get_dir_name_of_row(struct osl_row *dir_table_row, char **name) ret = osl(osl_get_object(dir_table, dir_table_row, DT_NAME, &obj)); if (ret < 0) return ret; - this_dir = para_strdup((char *)obj.data); + this_dir = adu_strdup((char *)obj.data); ret = osl(osl_get_object(dir_table, dir_table_row, DT_PARENT_NUM, &obj)); if (ret < 0) goto out; @@ -1090,7 +1090,7 @@ static int write_uid_list(void) if (!num_uids) return 0; - buf = para_malloc(size); + buf = adu_malloc(size); FOR_EACH_USER(ui) { if (!ui_used(ui) || !ui_admissible(ui)) continue; @@ -1098,7 +1098,7 @@ static int write_uid_list(void) write_u32(buf + count++ * sizeof(uint32_t), ui->uid); } filename = get_uid_list_name(); - ret = para_write_file(filename, buf, size); + ret = adu_write_file(filename, buf, size); free(filename); free(buf); return ret; @@ -1107,7 +1107,7 @@ static int write_uid_list(void) static int open_dir_table(void) { if (!dir_table_desc.dir) /* we did not create the table */ - dir_table_desc.dir = para_strdup(conf.database_dir_arg); + dir_table_desc.dir = adu_strdup(conf.database_dir_arg); return osl(osl_open_table(&dir_table_desc, &dir_table)); } static int com_create() @@ -1158,7 +1158,7 @@ static int read_uid_file(void) goto out; } out: - para_munmap(map, size); + adu_munmap(map, size); return ret; } @@ -1207,7 +1207,7 @@ static int check_args(void) } if (!conf.uid_given) return 0; - admissible_uids = para_malloc(conf.uid_given * sizeof(*admissible_uids)); + admissible_uids = adu_malloc(conf.uid_given * sizeof(*admissible_uids)); for (i = 0; i < conf.uid_given; i++) { ret = parse_uid_range(conf.uid_arg[i], admissible_uids + i); if (ret < 0) diff --git a/adu.h b/adu.h index 1e6519b..775af7f 100644 --- a/adu.h +++ b/adu.h @@ -107,7 +107,7 @@ __printf_2_3 void __log(int, const char*, ...); { \ int n; \ size_t size = 100; \ - p = para_malloc(size); \ + p = adu_malloc(size); \ while (1) { \ va_list ap; \ /* Try to print in the allocated space. */ \ @@ -122,6 +122,6 @@ __printf_2_3 void __log(int, const char*, ...); size = n + 1; /* precisely what is needed */ \ else /* glibc 2.0 */ \ size *= 2; /* twice the old size */ \ - p = para_realloc(p, size); \ + p = adu_realloc(p, size); \ } \ } diff --git a/fd.c b/fd.c index 40eb2fa..5c125fa 100644 --- a/fd.c +++ b/fd.c @@ -98,7 +98,7 @@ static int __open(const char *path, int flags, mode_t mode) * * \return Standard. */ -int para_write_file(const char *filename, const void *buf, size_t size) +int adu_write_file(const char *filename, const void *buf, size_t size) { int ret, fd; @@ -155,7 +155,7 @@ int __chdir(const char *path) * \sa getcwd(3). * */ -int para_opendir(const char *dirname, DIR **dir, int *cwd) +int adu_opendir(const char *dirname, DIR **dir, int *cwd) { int ret; @@ -188,7 +188,7 @@ close_cwd: * * \return Standard. */ -int para_fchdir(int fd) +int adu_fchdir(int fd) { if (fchdir(fd) < 0) return -ERRNO_TO_ERROR(errno); @@ -263,7 +263,7 @@ out: * * \sa munmap(2), mmap_full_file(). */ -int para_munmap(void *start, size_t length) +int adu_munmap(void *start, size_t length) { int err; if (munmap(start, length) >= 0) diff --git a/fd.h b/fd.h index ad81942..87083c2 100644 --- a/fd.h +++ b/fd.h @@ -6,9 +6,9 @@ /** \file fd.h exported symbols from fd.c */ -int para_opendir(const char *dirname, DIR **dir, int *cwd); -int para_fchdir(int fd); +int adu_opendir(const char *dirname, DIR **dir, int *cwd); +int adu_fchdir(int fd); int mmap_full_file(const char *filename, int open_mode, void **map, size_t *size, int *fd_ptr); -int para_munmap(void *start, size_t length); -int para_write_file(const char *filename, const void *buf, size_t size); +int adu_munmap(void *start, size_t length); +int adu_write_file(const char *filename, const void *buf, size_t size); diff --git a/string.c b/string.c index 8bd3446..a0666d3 100644 --- a/string.c +++ b/string.c @@ -25,7 +25,7 @@ * * \sa realloc(3). */ -__must_check __malloc void *para_realloc(void *p, size_t size) +__must_check __malloc void *adu_realloc(void *p, size_t size) { /* * No need to check for NULL pointers: If p is NULL, the call @@ -52,7 +52,7 @@ __must_check __malloc void *para_realloc(void *p, size_t size) * * \sa malloc(3). */ -__must_check __malloc void *para_malloc(size_t size) +__must_check __malloc void *adu_malloc(size_t size) { assert(size); void *p = malloc(size); @@ -77,9 +77,9 @@ __must_check __malloc void *para_malloc(size_t size) * * \sa calloc(3) */ -__must_check __malloc void *para_calloc(size_t size) +__must_check __malloc void *adu_calloc(size_t size) { - void *ret = para_malloc(size); + void *ret = adu_malloc(size); memset(ret, 0, size); return ret; @@ -98,7 +98,7 @@ __must_check __malloc void *para_calloc(size_t size) * * \sa strdup(3) */ -__must_check __malloc char *para_strdup(const char *s) +__must_check __malloc char *adu_strdup(const char *s) { char *ret; @@ -148,7 +148,7 @@ __must_check __printf_1_2 __malloc char *make_message(const char *fmt, ...) * * \sa strtol(3), atoi(3). */ -int para_atoi64(const char *str, int64_t *value) +__must_check int atoi64(const char *str, int64_t *result) { char *endptr; long long tmp; @@ -163,6 +163,6 @@ int para_atoi64(const char *str, int64_t *value) return -E_ATOI_NO_DIGITS; if (*endptr != '\0') /* Further characters after number */ return -E_ATOI_JUNK_AT_END; - *value = tmp; + *result = tmp; return 1; } diff --git a/string.h b/string.h index c98ed89..ebf3b17 100644 --- a/string.h +++ b/string.h @@ -6,9 +6,9 @@ /** \file string.h exported sybmols from string.c */ -__must_check __malloc void *para_realloc(void *p, size_t size); -__must_check __malloc void *para_malloc(size_t size); -__must_check __malloc void *para_calloc(size_t size); -__must_check __malloc char *para_strdup(const char *s); +__must_check __malloc void *adu_realloc(void *p, size_t size); +__must_check __malloc void *adu_malloc(size_t size); +__must_check __malloc void *adu_calloc(size_t size); +__must_check __malloc char *adu_strdup(const char *s); __must_check __malloc __printf_1_2 char *make_message(const char *fmt, ...); -int para_atoi64(const char *str, int64_t *result); +__must_check int atoi64(const char *str, int64_t *result); -- 2.39.2