Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=pacman-g2.git;a=commitdiff;h=72f703ec8b7e75d9c06606d01a050418c9d4fe7f

commit 72f703ec8b7e75d9c06606d01a050418c9d4fe7f
Author: Michel Hermier <[email protected]>
Date:   Thu Oct 31 17:19:07 2013 +0100

libpacman: Constify _pacman_needbackup parameters.

diff --git a/lib/libpacman/backup.c b/lib/libpacman/backup.c
index 143a5a9..71858e6 100644
--- a/lib/libpacman/backup.c
+++ b/lib/libpacman/backup.c
@@ -30,15 +30,16 @@
#include "backup.h"

#include "util/list.h"
+#include "util.h"

/* Look for a filename in a pmpkg_t.backup list.  If we find it,
* then we return the md5 or sha1 hash (parsed from the same line)
*/
-char *_pacman_needbackup(char *file, pmlist_t *backup)
+char *_pacman_needbackup(const char *file, const pmlist_t *backup)
{
-       pmlist_t *lp;
+       const pmlist_t *lp;

-       if(file == NULL || backup == NULL) {
+       if(_pacman_strempty(file) || backup == NULL) {
return(NULL);
}

@@ -57,9 +58,9 @@ char *_pacman_needbackup(char *file, pmlist_t *backup)
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);
}
diff --git a/lib/libpacman/backup.h b/lib/libpacman/backup.h
index 19f0b04..605f195 100644
--- a/lib/libpacman/backup.h
+++ b/lib/libpacman/backup.h
@@ -23,7 +23,7 @@

#include "pacman.h"

-char *_pacman_needbackup(char *file, pmlist_t *backup);
+char *_pacman_needbackup(const char *file, const pmlist_t *backup);

#endif /* _PACMAN_BACKUP_H */
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to