PERFORCE change 131987 for review

Garrett Cooper gcooper at FreeBSD.org
Sat Dec 29 13:19:47 PST 2007


http://perforce.freebsd.org/chv.cgi?CH=131987

Change 131987 by gcooper at shiina-ibook on 2007/12/29 21:18:53

	- Convert follow_link flag from int to unsigned char to save memory.
	- Reorder structs for better memory alignment (I think at least, given my info of the structs involved..). 

Affected files ...

.. //depot/projects/soc2007/revised_fbsd_pkgtools/pkg_revised/v2/contrib/libpkg/pkg.h#4 edit
.. //depot/projects/soc2007/revised_fbsd_pkgtools/pkg_revised/v2/contrib/libpkg/pkg_private.h#3 edit

Differences ...

==== //depot/projects/soc2007/revised_fbsd_pkgtools/pkg_revised/v2/contrib/libpkg/pkg.h#4 (text+ko) ====

@@ -49,7 +49,7 @@
  */
 struct pkgfile;
 
-struct pkgfile		*pkgfile_new_from_disk(const char *, int);
+struct pkgfile		*pkgfile_new_from_disk(const char *, unsigned char);
 struct pkgfile		*pkgfile_new_regular(const char *, const char *, uint64_t);
 struct pkgfile		*pkgfile_new_symlink(const char *, const char *);
 struct pkgfile		*pkgfile_new_hardlink(const char *, const char *);

==== //depot/projects/soc2007/revised_fbsd_pkgtools/pkg_revised/v2/contrib/libpkg/pkg_private.h#3 (text+ko) ====

@@ -51,20 +51,19 @@
 	pkgfile_dir /**< A directory */
 } pkgfile_type;
 
-/** @todo Reorder the struct to remove alignment gaps */
 struct pkgfile {
 	char		*name;
 	char		*cwd;
 	char		*real_name;
-	pkgfile_type	 type;
-	pkgfile_loc	 loc;
-	int		 follow_link;
-	FILE		*fd;
 	char		*data;
+	unsigned char	 follow_link;
+	char		 md5[33];
+	mode_t		 mode;
 	uint64_t	 length;
 	uint64_t	 offset;
-	mode_t		 mode;
-	char		 md5[33];
+	FILE		*fd;
+	pkgfile_type	 type;
+	pkgfile_loc	 loc;
 };
 
 /*
@@ -103,10 +102,11 @@
 	void		 *data;
 
 	char		 *manifest_version;
+	char		 *name;
+	char		 *attrs[pkgm_max];
+
 	struct pkgfile	 *file;
-	char		 *name;
 
-	char		 *attrs[pkgm_max];
 	STAILQ_HEAD(, pkgm_deps) deps;
 	STAILQ_HEAD(, pkgm_conflicts) conflicts;
 	STAILQ_HEAD(, pkgm_items) items;


More information about the p4-projects mailing list