From 06cbb516c35eb81220064878ff202c3107b12c99 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Tue, 8 Feb 2011 21:16:36 -0600 Subject: Avoid a memmove by advancing value pointer In packages, our description file contains: key = value is here type entries, and we passed "key " and " value is here" to our strtrim function, causing us to always memmove the value portion to remove the space. Since this is a throwaway buffer, do the advancing on our own before trimming to save the need to shift memory around; "value is here" will now be passed and strtrim will be responsible for trailing whitespace. Signed-off-by: Dan McGee --- lib/libalpm/be_package.c | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/libalpm') diff --git a/lib/libalpm/be_package.c b/lib/libalpm/be_package.c index 7e46c08e..38448b43 100644 --- a/lib/libalpm/be_package.c +++ b/lib/libalpm/be_package.c @@ -175,6 +175,7 @@ static int parse_descfile(struct archive *a, pmpkg_t *newpkg) newpkg->name ? newpkg->name : "error", linenum); } else { key = _alpm_strtrim(key); + while(*ptr == ' ') ptr++; ptr = _alpm_strtrim(ptr); if(strcmp(key, "pkgname") == 0) { STRDUP(newpkg->name, ptr, RET_ERR(PM_ERR_MEMORY, -1)); -- cgit v1.2.3-24-g4f1b