diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/compat/scandir.c | 6 | ||||
-rw-r--r-- | lib/dpkg/db-fsys-divert.c | 4 | ||||
-rw-r--r-- | lib/dpkg/db-fsys-override.c | 2 | ||||
-rw-r--r-- | lib/dpkg/ehandle.c | 6 | ||||
-rw-r--r-- | lib/dpkg/fields.c | 8 | ||||
-rw-r--r-- | lib/dpkg/fsys-hash.c | 4 | ||||
-rw-r--r-- | lib/dpkg/fsys-iter.c | 2 | ||||
-rw-r--r-- | lib/dpkg/log.c | 2 | ||||
-rw-r--r-- | lib/dpkg/parse.c | 2 | ||||
-rw-r--r-- | lib/dpkg/pkg-files.c | 2 | ||||
-rw-r--r-- | lib/dpkg/pkg-hash.c | 6 | ||||
-rw-r--r-- | lib/dpkg/treewalk.c | 4 |
12 files changed, 24 insertions, 24 deletions
diff --git a/lib/compat/scandir.c b/lib/compat/scandir.c index 4765d7dcb..8771de093 100644 --- a/lib/compat/scandir.c +++ b/lib/compat/scandir.c @@ -72,13 +72,13 @@ scandir(const char *dir, struct dirent ***namelist, avail *= 2; else avail = 20; - newlist = realloc(list, avail * sizeof(struct dirent *)); + newlist = realloc(list, avail * sizeof(*newlist)); if (!newlist) return cleanup(d, list, used); list = newlist; } - m = malloc(sizeof(struct dirent) + strlen(e->d_name)); + m = malloc(sizeof(*m) + strlen(e->d_name)); if (!m) return cleanup(d, list, used); *m = *e; @@ -91,7 +91,7 @@ scandir(const char *dir, struct dirent ***namelist, closedir(d); if (list != NULL && cmp != NULL) - qsort(list, used, sizeof(struct dirent *), cmp); + qsort(list, used, sizeof(list[0]), cmp); *namelist = list; diff --git a/lib/dpkg/db-fsys-divert.c b/lib/dpkg/db-fsys-divert.c index 775662382..b0edd1805 100644 --- a/lib/dpkg/db-fsys-divert.c +++ b/lib/dpkg/db-fsys-divert.c @@ -101,8 +101,8 @@ ensure_diversions(void) debug(dbg_general, "%s: new, (re)loading", __func__); while (fgets_checked(linebuf, sizeof(linebuf), file, diversionsname) >= 0) { - oicontest = nfmalloc(sizeof(struct diversion)); - oialtname = nfmalloc(sizeof(struct diversion)); + oicontest = nfmalloc(sizeof(*oicontest)); + oialtname = nfmalloc(sizeof(*oialtname)); oialtname->camefrom = findnamenode(linebuf, 0); oialtname->useinstead = NULL; diff --git a/lib/dpkg/db-fsys-override.c b/lib/dpkg/db-fsys-override.c index 10a8a273d..8da3afc29 100644 --- a/lib/dpkg/db-fsys-override.c +++ b/lib/dpkg/db-fsys-override.c @@ -184,7 +184,7 @@ ensure_statoverrides(enum statdb_parse_flags flags) thisline = loaded_list; while (thisline < loaded_list_end) { - fso = nfmalloc(sizeof(struct file_stat)); + fso = nfmalloc(sizeof(*fso)); ptr = memchr(thisline, '\n', loaded_list_end - thisline); if (ptr == NULL) diff --git a/lib/dpkg/ehandle.c b/lib/dpkg/ehandle.c index ae3b46aad..81ce47e31 100644 --- a/lib/dpkg/ehandle.c +++ b/lib/dpkg/ehandle.c @@ -135,7 +135,7 @@ error_context_new(void) { struct error_context *necp; - necp = malloc(sizeof(struct error_context)); + necp = malloc(sizeof(*necp)); if (!necp) ohshite(_("out of memory for new error context")); necp->next= econtext; @@ -311,7 +311,7 @@ void push_checkpoint(int mask, int value) { struct cleanup_entry *cep; int i; - cep = malloc(sizeof(struct cleanup_entry) + sizeof(char *)); + cep = malloc(sizeof(*cep) + sizeof(void *)); if (cep == NULL) { onerr_abort++; ohshite(_("out of memory for new cleanup entry")); @@ -336,7 +336,7 @@ cleanup_entry_new(void (*call1)(int argc, void **argv), int mask1, onerr_abort++; - cep = malloc(sizeof(struct cleanup_entry) + sizeof(char *) * (nargs + 1)); + cep = malloc(sizeof(*cep) + sizeof(void *) * (nargs + 1)); if (!cep) { if (nargs > array_count(emergency.args)) ohshite(_("out of memory for new cleanup entry with many arguments")); diff --git a/lib/dpkg/fields.c b/lib/dpkg/fields.c index cfa1075b2..39044e2a5 100644 --- a/lib/dpkg/fields.c +++ b/lib/dpkg/fields.c @@ -138,7 +138,7 @@ f_archives(struct pkginfo *pkg, struct pkgbin *pkgbin, parse_error(ps, _("too many values in archive details field '%s' " "(compared to others)"), fip->name); - fdp = nfmalloc(sizeof(struct archivedetails)); + fdp = nfmalloc(sizeof(*fdp)); fdp->next= NULL; fdp->name= fdp->msdosname= fdp->size= fdp->md5sum= NULL; *fdpp= fdp; @@ -360,7 +360,7 @@ f_conffiles(struct pkginfo *pkg, struct pkgbin *pkgbin, conffvalue_lastword(value, endfn, endent, &hashstart, &hashlen, &endfn, ps); - newlink= nfmalloc(sizeof(struct conffile)); + newlink = nfmalloc(sizeof(*newlink)); value = path_skip_slash_dotslash(value); namelen= (int)(endfn-value); if (namelen <= 0) @@ -408,7 +408,7 @@ f_dependency(struct pkginfo *pkg, struct pkgbin *pkgbin, /* Loop creating new struct dependency's. */ for (;;) { - dyp= nfmalloc(sizeof(struct dependency)); + dyp = nfmalloc(sizeof(*dyp)); /* Set this to NULL for now, as we don't know what our real * struct pkginfo address (in the database) is going to be yet. */ dyp->up = NULL; @@ -438,7 +438,7 @@ f_dependency(struct pkginfo *pkg, struct pkgbin *pkgbin, parse_error(ps, _("'%s' field, invalid package name '%.255s': %s"), fip->name, depname.buf, emsg); - dop= nfmalloc(sizeof(struct deppossi)); + dop = nfmalloc(sizeof(*dop)); dop->up= dyp; dop->ed = pkg_db_find_set(depname.buf); dop->next= NULL; *ldopp= dop; ldopp= &dop->next; diff --git a/lib/dpkg/fsys-hash.c b/lib/dpkg/fsys-hash.c index 002528c6c..0190d94fb 100644 --- a/lib/dpkg/fsys-hash.c +++ b/lib/dpkg/fsys-hash.c @@ -102,7 +102,7 @@ findnamenode(const char *name, enum fnnflags flags) if (flags & fnn_nonew) return NULL; - newnode = nfmalloc(sizeof(struct filenamenode)); + newnode = nfmalloc(sizeof(*newnode)); newnode->packages = NULL; if ((flags & fnn_nocopy) && name > orig_name && name[-1] == '/') { newnode->name = name - 1; @@ -141,7 +141,7 @@ files_db_iter_new(void) { struct fileiterator *iter; - iter = m_malloc(sizeof(struct fileiterator)); + iter = m_malloc(sizeof(*iter)); iter->namenode = NULL; iter->nbinn = 0; diff --git a/lib/dpkg/fsys-iter.c b/lib/dpkg/fsys-iter.c index aba31aa47..fb47197ef 100644 --- a/lib/dpkg/fsys-iter.c +++ b/lib/dpkg/fsys-iter.c @@ -49,7 +49,7 @@ reversefilelist_init(struct reversefilelistiter *iter, iter->todo = NULL; while (files) { - newent = m_malloc(sizeof(struct fileinlist)); + newent = m_malloc(sizeof(*newent)); newent->namenode = files->namenode; newent->next = iter->todo; iter->todo = newent; diff --git a/lib/dpkg/log.c b/lib/dpkg/log.c index 3079f3ca6..c2221c819 100644 --- a/lib/dpkg/log.c +++ b/lib/dpkg/log.c @@ -83,7 +83,7 @@ statusfd_add(int fd) setcloexec(fd, _("<package status and progress file descriptor>")); - pipe_new = nfmalloc(sizeof(struct pipef)); + pipe_new = nfmalloc(sizeof(*pipe_new)); pipe_new->fd = fd; pipe_new->next = status_pipes; status_pipes = pipe_new; diff --git a/lib/dpkg/parse.c b/lib/dpkg/parse.c index 158e4d11e..14d6192f5 100644 --- a/lib/dpkg/parse.c +++ b/lib/dpkg/parse.c @@ -159,7 +159,7 @@ pkg_parse_field(struct parsedb_state *ps, struct field_state *fs, fs->fieldlen, fs->fieldstart); larpp = &arp->next; } - arp = nfmalloc(sizeof(struct arbitraryfield)); + arp = nfmalloc(sizeof(*arp)); arp->name = nfstrnsave(fs->fieldstart, fs->fieldlen); arp->value = nfstrnsave(fs->valuestart, fs->valuelen); arp->next = NULL; diff --git a/lib/dpkg/pkg-files.c b/lib/dpkg/pkg-files.c index e60134a32..349e63d4f 100644 --- a/lib/dpkg/pkg-files.c +++ b/lib/dpkg/pkg-files.c @@ -78,7 +78,7 @@ pkg_files_add_file(struct pkginfo *pkg, struct filenamenode *namenode, file_tail = &((*file_tail)->next); /* Create a new node. */ - newent = nfmalloc(sizeof(struct fileinlist)); + newent = nfmalloc(sizeof(*newent)); newent->namenode = namenode; newent->next = NULL; *file_tail = newent; diff --git a/lib/dpkg/pkg-hash.c b/lib/dpkg/pkg-hash.c index 6413b5058..398c20607 100644 --- a/lib/dpkg/pkg-hash.c +++ b/lib/dpkg/pkg-hash.c @@ -79,7 +79,7 @@ pkg_db_find_set(const char *inname) return *setp; } - new_set = nfmalloc(sizeof(struct pkgset)); + new_set = nfmalloc(sizeof(*new_set)); pkgset_blank(new_set); new_set->name = nfstrsave(name); new_set->next = NULL; @@ -195,7 +195,7 @@ pkg_db_get_pkg(struct pkgset *set, const struct dpkg_arch *arch) } /* Need to create a new instance for the wanted architecture. */ - pkg = nfmalloc(sizeof(struct pkginfo)); + pkg = nfmalloc(sizeof(*pkg)); pkg_blank(pkg); pkg->set = set; pkg->arch_next = NULL; @@ -268,7 +268,7 @@ pkg_db_iter_new(void) { struct pkgiterator *iter; - iter = m_malloc(sizeof(struct pkgiterator)); + iter = m_malloc(sizeof(*iter)); iter->pkg = NULL; iter->nbinn = 0; diff --git a/lib/dpkg/treewalk.c b/lib/dpkg/treewalk.c index 3a669e6b0..dee072f2d 100644 --- a/lib/dpkg/treewalk.c +++ b/lib/dpkg/treewalk.c @@ -206,7 +206,7 @@ treenode_resize_down(struct treenode *node) else node->down_size = 8; - new_size = node->down_size * sizeof(struct treenode *); + new_size = node->down_size * sizeof(*node); node->down = m_realloc(node->down, new_size); } @@ -367,7 +367,7 @@ treewalk_open(const char *rootdir, enum treewalk_options options, struct treeroot *tree; struct treenode *root; - tree = m_malloc(sizeof(struct treeroot)); + tree = m_malloc(sizeof(*tree)); tree->options = options; if (func) |