diff options
author | Dan McGee <dan@archlinux.org> | 2011-01-07 20:35:43 -0600 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-01-07 20:55:05 -0600 |
commit | 4bc6ed56aa48784c8caf56c3a6fb1a3c972d221c (patch) | |
tree | 164ca843d1450f9b3534760fb670adc39cfe8e08 /lib/libalpm/be_sync.c | |
parent | d288240426551e9d58a708e28fe0217e56d017d6 (diff) | |
download | pacman-4bc6ed56aa48784c8caf56c3a6fb1a3c972d221c.tar.xz |
Refactor old date parsing into single method
We've managed to duplicate this four times at this point, so make it a
method in util.c instead.
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/be_sync.c')
-rw-r--r-- | lib/libalpm/be_sync.c | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/lib/libalpm/be_sync.c b/lib/libalpm/be_sync.c index c7d8e045..81f3e46e 100644 --- a/lib/libalpm/be_sync.c +++ b/lib/libalpm/be_sync.c @@ -21,7 +21,6 @@ #include "config.h" #include <errno.h> -#include <ctype.h> #include <locale.h> #include <limits.h> @@ -313,17 +312,7 @@ static int sync_db_read(pmdb_t *db, struct archive *archive, struct archive_entr READ_AND_STORE(pkg->arch); } else if(strcmp(line, "%BUILDDATE%") == 0) { READ_NEXT(line); - char first = tolower((unsigned char)line[0]); - if(first > 'a' && first < 'z') { - /* initialize to null in case of failure */ - struct tm tmp_tm = {0}; - setlocale(LC_TIME, "C"); - strptime(line, "%a %b %e %H:%M:%S %Y", &tmp_tm); - pkg->builddate = mktime(&tmp_tm); - setlocale(LC_TIME, ""); - } else { - pkg->builddate = atol(line); - } + pkg->builddate = _alpm_parsedate(line); } else if(strcmp(line, "%PACKAGER%") == 0) { READ_AND_STORE(pkg->packager); } else if(strcmp(line, "%CSIZE%") == 0) { |