From 49c29e16b31ce35e81be210bc74a3834530bb9e0 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Tue, 14 Aug 2007 09:33:55 -0400 Subject: Code cleanup Remove the commented desc_localized stuff, we can find it later in version control. Also remove some unnecessary includes of the stat header and use -fstack-protector-all which is a bit more broad. Signed-off-by: Dan McGee --- lib/libalpm/be_files.c | 36 ------------------------------------ lib/libalpm/cache.c | 1 - lib/libalpm/conflict.c | 3 --- lib/libalpm/package.c | 17 ----------------- lib/libalpm/package.h | 1 - 5 files changed, 58 deletions(-) (limited to 'lib') diff --git a/lib/libalpm/be_files.c b/lib/libalpm/be_files.c index ea00563e..dc89f32f 100644 --- a/lib/libalpm/be_files.c +++ b/lib/libalpm/be_files.c @@ -235,10 +235,6 @@ int _alpm_db_read(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq) struct stat buf; char path[PATH_MAX+1]; char line[513]; - /* - alpm_list_t *tmplist; - char *locale; - */ ALPM_LOG_FUNC; @@ -303,32 +299,6 @@ int _alpm_db_read(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq) if(fgets(info->desc, sizeof(info->desc), fp) == NULL) { goto error; } - /* - while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) { - info->desc_localized = alpm_list_add(info->desc_localized, strdup(line)); - PKG_ - } - - if((locale = setlocale(LC_ALL, "")) == NULL) { //To fix segfault when locale invalid - setenv("LC_ALL", "C", 1); - locale = setlocale(LC_ALL, ""); - } - - if(info->desc_localized && !info->desc_localized->next) { - snprintf(info->desc, 512, "%s", (char*)info->desc_localized->data); - } else { - for (tmplist = info->desc_localized; tmplist; tmplist = tmplist->next) { - if (tmplist->data && strncmp(tmplist->data, locale, strlen(locale))) { - strncpy(info->desc, (char *)info->desc_localized->data, sizeof(info->desc)); - } else { - char *p = (char *)tmplist->data; - p += strlen(locale) + 1; - strncpy(info->desc, p, sizeof(info->desc)); - break; - } - } - } - */ _alpm_strtrim(info->desc); } else if(!strcmp(line, "%GROUPS%")) { while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) { @@ -545,12 +515,6 @@ int _alpm_db_write(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq) fprintf(fp, "%%NAME%%\n%s\n\n" "%%VERSION%%\n%s\n\n", info->name, info->version); if(info->desc[0]) { - /*fputs("%DESC%\n", fp); - for(lp = info->desc_localized; lp; lp = lp->next) { - fprintf(fp, "%s\n", (char *)lp->data); - } - fprintf(fp, "\n"); - */ fprintf(fp, "%%DESC%%\n" "%s\n\n", info->desc); } diff --git a/lib/libalpm/cache.c b/lib/libalpm/cache.c index 4852f0fc..5afff6cc 100644 --- a/lib/libalpm/cache.c +++ b/lib/libalpm/cache.c @@ -26,7 +26,6 @@ #include #include #include -#include /* libalpm */ #include "cache.h" diff --git a/lib/libalpm/conflict.c b/lib/libalpm/conflict.c index 46d1f227..c7e5eeb4 100644 --- a/lib/libalpm/conflict.c +++ b/lib/libalpm/conflict.c @@ -30,9 +30,6 @@ #include #include #include -#if defined(__APPLE__) || defined(__OpenBSD__) -#include -#endif #include /* libalpm */ diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c index d5eca20b..61922e30 100644 --- a/lib/libalpm/package.c +++ b/lib/libalpm/package.c @@ -744,7 +744,6 @@ pmpkg_t *_alpm_pkg_dup(pmpkg_t *pkg) memcpy(newpkg, pkg, sizeof(pmpkg_t)); newpkg->licenses = alpm_list_strdup(alpm_pkg_get_licenses(pkg)); - /*newpkg->desc_localized = alpm_list_strdup(pkg->desc_localized);*/ newpkg->requiredby = alpm_list_strdup(alpm_pkg_get_requiredby(pkg)); newpkg->conflicts = alpm_list_strdup(alpm_pkg_get_conflicts(pkg)); newpkg->files = alpm_list_strdup(alpm_pkg_get_files(pkg)); @@ -768,7 +767,6 @@ void _alpm_pkg_free(pmpkg_t *pkg) } FREELIST(pkg->licenses); - /*FREELIST(pkg->desc_localized);*/ FREELIST(pkg->files); FREELIST(pkg->backup); FREELIST(pkg->depends); @@ -885,22 +883,7 @@ static int parse_descfile(const char *descfile, pmpkg_t *info) } else if(!strcmp(key, "PKGVER")) { strncpy(info->version, ptr, sizeof(info->version)); } else if(!strcmp(key, "PKGDESC")) { - /* - char *lang_tmp; - info->desc_localized = alpm_list_add(info->desc_localized, strdup(ptr)); - if((lang_tmp = malloc(strlen(setlocale(LC_ALL, "")))) == NULL) { - RET_ERR(PM_ERR_MEMORY, -1); - } - strncpy(lang_tmp, setlocale(LC_ALL, ""), strlen(setlocale(LC_ALL, ""))); - if(info->desc_localized && !info->desc_localized->next) { - */ strncpy(info->desc, ptr, sizeof(info->desc)); - /* - } else if (ptr && !strncmp(ptr, lang_tmp, strlen(lang_tmp))) { - strncpy(info->desc, ptr+strlen(lang_tmp)+1, sizeof(info->desc)); - } - FREE(lang_tmp); - */ } else if(!strcmp(key, "GROUP")) { info->groups = alpm_list_add(info->groups, strdup(ptr)); } else if(!strcmp(key, "URL")) { diff --git a/lib/libalpm/package.h b/lib/libalpm/package.h index f704ab9c..41ab5f0d 100644 --- a/lib/libalpm/package.h +++ b/lib/libalpm/package.h @@ -67,7 +67,6 @@ struct __pmpkg_t { unsigned short force; time_t date; pmpkgreason_t reason; - /* alpm_list_t *desc_localized;*/ alpm_list_t *licenses; alpm_list_t *replaces; alpm_list_t *groups; -- cgit v1.2.3-70-g09d2