[pacman-dev] Long functions and other minor fixes
Dan McGee
dpmcgee at gmail.com
Fri Dec 22 13:37:37 EST 2006
Some more functions that are worth taking a look at on the libalpm side:
add.c:
_alpm_add_commit
be_files.c:
_alpm_db_read
_alpm_db_write
conflict.c:
_alpm_checkconflicts
_alpm_db_find_conflicts
package.c:
_alpm_pkg_load (getting a bit long)
remove.c:
_alpm_remove_commit
server.c:
_alpm_downloadfiles_forreal
sync.c:
_alpm_sync_sysupgrade (getting there)
_alpm_sync_prepare
_alpm_sync_commit
And some minor things I found in the code- cleaned up an extern enum,
changed 'md5' variable to 'hash' as it can be either md5 or sha1,
resorted db.h for clarity, and fixed some English grammar issues. Here
is a patch:
Index: lib/libalpm/alpm.h
===================================================================
RCS file: /home/cvs-pacman/pacman-lib/lib/libalpm/alpm.h,v
retrieving revision 1.64
diff -u -u -r1.64 alpm.h
--- lib/libalpm/alpm.h 22 Nov 2006 09:03:41 -0000 1.64
+++ lib/libalpm/alpm.h 22 Dec 2006 18:34:01 -0000
@@ -399,7 +399,7 @@
/*
* Errors
*/
-extern enum __pmerrno_t {
+enum __pmerrno_t {
PM_ERR_MEMORY = 1,
PM_ERR_SYSTEM,
PM_ERR_BADPERMS,
@@ -469,7 +469,9 @@
/* Downloading */
PM_ERR_CONNECT_FAILED,
PM_ERR_FORK_FAILED
-} pm_errno;
+};
+
+extern enum __pmerrno_t pm_errno;
char *alpm_strerror(int err);
Index: lib/libalpm/backup.c
===================================================================
RCS file: /home/cvs-pacman/pacman-lib/lib/libalpm/backup.c,v
retrieving revision 1.7
diff -u -u -r1.7 backup.c
--- lib/libalpm/backup.c 31 Oct 2006 06:39:59 -0000 1.7
+++ lib/libalpm/backup.c 22 Dec 2006 18:34:01 -0000
@@ -55,9 +55,9 @@
ptr++;
/* now str points to the filename and ptr points to
the md5 or sha1 hash */
if(!strcmp(file, str)) {
- char *md5 = strdup(ptr);
+ char *hash = strdup(ptr);
FREE(str);
- return(md5);
+ return(hash);
}
FREE(str);
}
Index: lib/libalpm/db.h
===================================================================
RCS file: /home/cvs-pacman/pacman-lib/lib/libalpm/db.h,v
retrieving revision 1.20
diff -u -u -r1.20 db.h
--- lib/libalpm/db.h 20 Nov 2006 09:10:24 -0000 1.20
+++ lib/libalpm/db.h 22 Dec 2006 18:34:01 -0000
@@ -44,10 +44,14 @@
pmlist_t *servers;
};
+/* db.c, database general calls */
pmdb_t *_alpm_db_new(char *root, char *dbpath, char *treename);
void _alpm_db_free(void *data);
int _alpm_db_cmp(const void *db1, const void *db2);
pmlist_t *_alpm_db_search(pmdb_t *db, pmlist_t *needles);
+pmdb_t *_alpm_db_register(char *treename, alpm_cb_db_register callback);
+
+/* be.c, backend specific */
int _alpm_db_install(pmdb_t *db, const char *dbfile);
int _alpm_db_open(pmdb_t *db);
void _alpm_db_close(pmdb_t *db);
@@ -58,7 +62,6 @@
int _alpm_db_remove(pmdb_t *db, pmpkg_t *info);
int _alpm_db_getlastupdate(pmdb_t *db, char *ts);
int _alpm_db_setlastupdate(pmdb_t *db, char *ts);
-pmdb_t *_alpm_db_register(char *treename, alpm_cb_db_register callback);
#endif /* _ALPM_DB_H */
Index: lib/libalpm/sync.c
===================================================================
RCS file: /home/cvs-pacman/pacman-lib/lib/libalpm/sync.c,v
retrieving revision 1.85
diff -u -u -r1.85 sync.c
--- lib/libalpm/sync.c 1 Dec 2006 09:32:30 -0000 1.85
+++ lib/libalpm/sync.c 22 Dec 2006 18:34:03 -0000
@@ -382,7 +382,7 @@
{
pmlist_t *deps = NULL;
pmlist_t *list = NULL; /* list allowing checkdeps usage with
data from trans->packages */
- pmlist_t *trail = NULL; /* breadcrum list to avoid running
into circles */
+ pmlist_t *trail = NULL; /* breadcrumb list to avoid running in
circles */
pmlist_t *asked = NULL;
pmlist_t *i, *j, *k, *l;
int ret = 0;
More information about the pacman-dev
mailing list