Переглянути джерело

libdpkg: Rename TarInfo to tar_entry

Guillem Jover 16 роки тому
батько
коміт
ccb9d03ffd
6 змінених файлів з 20 додано та 15 видалено
  1. 4 4
      lib/dpkg/tarfn.c
  2. 2 2
      lib/dpkg/tarfn.h
  3. 11 6
      src/archives.c
  4. 1 1
      src/archives.h
  5. 1 1
      src/filters.c
  6. 1 1
      src/filters.h

+ 4 - 4
lib/dpkg/tarfn.c

@@ -111,7 +111,7 @@ get_prefix_name(struct TarHeader *h)
 }
 
 static int
-DecodeTarHeader(char *block, struct TarInfo *d)
+DecodeTarHeader(char *block, struct tar_entry *d)
 {
 	struct TarHeader *h = (struct TarHeader *)block;
 	unsigned char *s = (unsigned char *)block;
@@ -174,8 +174,8 @@ DecodeTarHeader(char *block, struct TarInfo *d)
 }
 
 struct symlinkList {
-	struct TarInfo h;
 	struct symlinkList *next;
+	struct tar_entry h;
 };
 
 int
@@ -183,7 +183,7 @@ tar_extractor(void *ctx, const struct tar_operations *ops)
 {
 	int status;
 	char buffer[TARBLKSZ];
-	struct TarInfo h;
+	struct tar_entry h;
 
 	char *next_long_name, *next_long_link;
 	char *bp;
@@ -253,7 +253,7 @@ tar_extractor(void *ctx, const struct tar_operations *ops)
 			break;
 		case tar_filetype_symlink:
 			symlink_node = m_malloc(sizeof(*symlink_node));
-			memcpy(&symlink_node->h, &h, sizeof(struct TarInfo));
+			memcpy(&symlink_node->h, &h, sizeof(struct tar_entry));
 			symlink_node->h.name = m_strdup(h.name);
 			symlink_node->h.linkname = m_strdup(h.linkname);
 			symlink_node->next = NULL;

+ 2 - 2
lib/dpkg/tarfn.h

@@ -48,7 +48,7 @@ enum tar_filetype {
 	tar_filetype_gnu_longname = 'L',
 };
 
-struct	TarInfo {
+struct tar_entry {
 	enum tar_format format;	/* Tar archive format. */
 	enum tar_filetype type;	/* Regular, Directory, Special, Link */
 	char *name;		/* File name */
@@ -62,7 +62,7 @@ struct	TarInfo {
 };
 
 typedef int (*tar_read_func)(void *ctx, char *buffer, int length);
-typedef int (*tar_func)(void *ctx, struct TarInfo *h);
+typedef int (*tar_func)(void *ctx, struct tar_entry *h);
 
 struct tar_operations {
 	tar_read_func read;

+ 11 - 6
src/archives.c

@@ -180,7 +180,7 @@ int tarfileread(void *ud, char *buf, int len) {
 }
 
 static void
-tarfile_skip_one_forward(struct tarcontext *tc, struct TarInfo *ti)
+tarfile_skip_one_forward(struct tarcontext *tc, struct tar_entry *ti)
 {
   size_t r;
   char databuf[TARBLKSZ];
@@ -230,7 +230,9 @@ does_replace(struct pkginfo *newpigp, struct pkginfoperfile *newpifp,
   return false;
 }
 
-static void newtarobject_utime(const char *path, struct TarInfo *ti) {
+static void
+newtarobject_utime(const char *path, struct tar_entry *ti)
+{
   struct utimbuf utb;
   utb.actime= currenttime;
   utb.modtime = ti->mtime;
@@ -238,7 +240,10 @@ static void newtarobject_utime(const char *path, struct TarInfo *ti) {
     ohshite(_("error setting timestamps of `%.255s'"), ti->name);
 }
 
-static void newtarobject_allmodes(const char *path, struct TarInfo *ti, struct filestatoverride* statoverride) {
+static void
+newtarobject_allmodes(const char *path, struct tar_entry *ti,
+                      struct filestatoverride *statoverride)
+{
   if (chown(path,
             statoverride ? statoverride->uid : ti->uid,
             statoverride ? statoverride->gid : ti->gid))
@@ -337,7 +342,7 @@ struct fileinlist *addfiletolist(struct tarcontext *tc,
 }
 
 static void
-remove_file_from_list(struct tarcontext *tc, struct TarInfo *ti,
+remove_file_from_list(struct tarcontext *tc, struct tar_entry *ti,
                       struct fileinlist **oldnifd,
                       struct fileinlist *nifd)
 {
@@ -347,7 +352,7 @@ remove_file_from_list(struct tarcontext *tc, struct TarInfo *ti,
 }
 
 static bool
-linktosameexistingdir(const struct TarInfo *ti, const char *fname,
+linktosameexistingdir(const struct tar_entry *ti, const char *fname,
                       struct varbuf *symlinkfn)
 {
   struct stat oldstab, newstab;
@@ -392,7 +397,7 @@ linktosameexistingdir(const struct TarInfo *ti, const char *fname,
 }
 
 int
-tarobject(void *ctx, struct TarInfo *ti)
+tarobject(void *ctx, struct tar_entry *ti)
 {
   static struct varbuf conffderefn, hardlinkfn, symlinkfn;
   static int fd;

+ 1 - 1
src/archives.h

@@ -64,7 +64,7 @@ void ok_prermdeconfigure(int argc, void **argv);
 void setupfnamevbs(const char *filename);
 int unlinkorrmdir(const char *filename);
 
-int tarobject(void *ctx, struct TarInfo *ti);
+int tarobject(void *ctx, struct tar_entry *ti);
 int tarfileread(void *ud, char *buf, int len);
 void tar_deferred_extract(struct fileinlist *files, struct pkginfo *pkg);
 

+ 1 - 1
src/filters.c

@@ -61,7 +61,7 @@ filter_add(const char *pattern, bool include)
 }
 
 bool
-filter_should_skip(struct TarInfo *ti)
+filter_should_skip(struct tar_entry *ti)
 {
 	struct filter_node *f;
 	bool skip = false;

+ 1 - 1
src/filters.h

@@ -30,7 +30,7 @@
 DPKG_BEGIN_DECLS
 
 void filter_add(const char *glob, bool include);
-bool filter_should_skip(struct TarInfo *ti);
+bool filter_should_skip(struct tar_entry *ti);
 
 DPKG_END_DECLS