1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-12-22 15:58:50 -05:00

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 <dan@archlinux.org>
This commit is contained in:
Dan McGee 2007-08-14 09:33:55 -04:00
parent 47ee89ada9
commit 49c29e16b3
8 changed files with 1 additions and 61 deletions

View File

@ -201,7 +201,7 @@ AM_CONDITIONAL(HAS_DOXYGEN, test "x$usedoxygen" = "xyes")
AC_MSG_CHECKING(for debug mode request) AC_MSG_CHECKING(for debug mode request)
if test "x$debug" = "xyes" ; then if test "x$debug" = "xyes" ; then
AC_DEFINE([PACMAN_DEBUG], , [Enable debug code]) AC_DEFINE([PACMAN_DEBUG], , [Enable debug code])
CFLAGS="$CFLAGS -g -Wall -Werror -fstack-protector -std=c99" CFLAGS="$CFLAGS -g -Wall -Werror -fstack-protector-all -std=c99"
LDFLAGS="$LDFLAGS -lmcheck" LDFLAGS="$LDFLAGS -lmcheck"
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
else else

View File

@ -235,10 +235,6 @@ int _alpm_db_read(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq)
struct stat buf; struct stat buf;
char path[PATH_MAX+1]; char path[PATH_MAX+1];
char line[513]; char line[513];
/*
alpm_list_t *tmplist;
char *locale;
*/
ALPM_LOG_FUNC; 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) { if(fgets(info->desc, sizeof(info->desc), fp) == NULL) {
goto error; 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); _alpm_strtrim(info->desc);
} else if(!strcmp(line, "%GROUPS%")) { } else if(!strcmp(line, "%GROUPS%")) {
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) { 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" fprintf(fp, "%%NAME%%\n%s\n\n"
"%%VERSION%%\n%s\n\n", info->name, info->version); "%%VERSION%%\n%s\n\n", info->name, info->version);
if(info->desc[0]) { 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" fprintf(fp, "%%DESC%%\n"
"%s\n\n", info->desc); "%s\n\n", info->desc);
} }

View File

@ -26,7 +26,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <errno.h> #include <errno.h>
#include <string.h> #include <string.h>
#include <sys/stat.h>
/* libalpm */ /* libalpm */
#include "cache.h" #include "cache.h"

View File

@ -30,9 +30,6 @@
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
#include <limits.h> #include <limits.h>
#if defined(__APPLE__) || defined(__OpenBSD__)
#include <sys/syslimits.h>
#endif
#include <sys/stat.h> #include <sys/stat.h>
/* libalpm */ /* libalpm */

View File

@ -744,7 +744,6 @@ pmpkg_t *_alpm_pkg_dup(pmpkg_t *pkg)
memcpy(newpkg, pkg, sizeof(pmpkg_t)); memcpy(newpkg, pkg, sizeof(pmpkg_t));
newpkg->licenses = alpm_list_strdup(alpm_pkg_get_licenses(pkg)); 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->requiredby = alpm_list_strdup(alpm_pkg_get_requiredby(pkg));
newpkg->conflicts = alpm_list_strdup(alpm_pkg_get_conflicts(pkg)); newpkg->conflicts = alpm_list_strdup(alpm_pkg_get_conflicts(pkg));
newpkg->files = alpm_list_strdup(alpm_pkg_get_files(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->licenses);
/*FREELIST(pkg->desc_localized);*/
FREELIST(pkg->files); FREELIST(pkg->files);
FREELIST(pkg->backup); FREELIST(pkg->backup);
FREELIST(pkg->depends); FREELIST(pkg->depends);
@ -885,22 +883,7 @@ static int parse_descfile(const char *descfile, pmpkg_t *info)
} else if(!strcmp(key, "PKGVER")) { } else if(!strcmp(key, "PKGVER")) {
strncpy(info->version, ptr, sizeof(info->version)); strncpy(info->version, ptr, sizeof(info->version));
} else if(!strcmp(key, "PKGDESC")) { } 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)); 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")) { } else if(!strcmp(key, "GROUP")) {
info->groups = alpm_list_add(info->groups, strdup(ptr)); info->groups = alpm_list_add(info->groups, strdup(ptr));
} else if(!strcmp(key, "URL")) { } else if(!strcmp(key, "URL")) {

View File

@ -67,7 +67,6 @@ struct __pmpkg_t {
unsigned short force; unsigned short force;
time_t date; time_t date;
pmpkgreason_t reason; pmpkgreason_t reason;
/* alpm_list_t *desc_localized;*/
alpm_list_t *licenses; alpm_list_t *licenses;
alpm_list_t *replaces; alpm_list_t *replaces;
alpm_list_t *groups; alpm_list_t *groups;

View File

@ -25,7 +25,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/time.h> #include <sys/time.h>
#include <sys/stat.h>
#include <unistd.h> #include <unistd.h>
#include <dirent.h> #include <dirent.h>
#include <wchar.h> #include <wchar.h>

View File

@ -24,7 +24,6 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/stat.h>
#include <unistd.h> #include <unistd.h>
#include <dirent.h> #include <dirent.h>