diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2012-05-14 10:53:49 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2012-05-14 10:53:49 +0300 |
commit | e0564b7c71e9e675af27d0ee79bee15db152a1c8 (patch) | |
tree | 28b66f258570b3544726357e86ecf7dd08a384f4 /build | |
parent | 654638357c4f1c4002105c0f42f950fec9d3ccd8 (diff) | |
download | rpm-e0564b7c71e9e675af27d0ee79bee15db152a1c8.tar.gz rpm-e0564b7c71e9e675af27d0ee79bee15db152a1c8.tar.bz2 rpm-e0564b7c71e9e675af27d0ee79bee15db152a1c8.zip |
Only pass what's needed to parseForAttr()
- It doesn't need the entire filelist, just the buffer and current
or defaul file entry pointer
Diffstat (limited to 'build')
-rw-r--r-- | build/files.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/build/files.c b/build/files.c index bb413c84a..8dbeb73a5 100644 --- a/build/files.c +++ b/build/files.c @@ -447,25 +447,24 @@ exit: /** * Parse %attr and %defattr from file manifest. * @param buf current spec file line - * @param fl package file tree walk data + * @param cur current file entry data + * @param def default file entry data * @return 0 on success */ -static rpmRC parseForAttr(char * buf, FileList fl) +static rpmRC parseForAttr(char * buf, FileEntry cur, FileEntry def) { const char *name; char *p, *pe, *q = NULL; int x; struct AttrRec_s arbuf; - AttrRec ar = &arbuf, ret_ar; - specfFlags * specdFlags; + AttrRec ar = &arbuf; rpmRC rc = RPMRC_FAIL; + FileEntry entry = NULL; if ((p = strstr(buf, (name = "%attr"))) != NULL) { - ret_ar = &(fl->cur.ar); - specdFlags = &fl->cur.specdFlags; + entry = cur; } else if ((p = strstr(buf, (name = "%defattr"))) != NULL) { - ret_ar = &(fl->def.ar); - specdFlags = &fl->def.specdFlags; + entry = def; } else return RPMRC_OK; @@ -484,7 +483,7 @@ static rpmRC parseForAttr(char * buf, FileList fl) for (p = pe; *pe && *pe != ')'; pe++) {}; - if (ret_ar == &(fl->def.ar)) { /* %defattr */ + if (entry == def) { /* %defattr */ char *r = pe; r++; SKIPSPACE(r); @@ -519,7 +518,7 @@ static rpmRC parseForAttr(char * buf, FileList fl) ar->ar_group = p; p = pe; SKIPWHITE(p); } - if (*p != '\0' && ret_ar == &(fl->def.ar)) { /* %defattr */ + if (*p != '\0' && entry == def) { /* %defattr */ pe = p; SKIPNONWHITE(pe); if (*pe != '\0') *pe++ = '\0'; ar->ar_dmodestr = p; p = pe; SKIPWHITE(p); @@ -563,10 +562,10 @@ static rpmRC parseForAttr(char * buf, FileList fl) ar->ar_group = NULL; } - dupAttrRec(ar, ret_ar); + dupAttrRec(ar, &(entry->ar)); /* XXX fix all this */ - *specdFlags |= SPECD_UID | SPECD_GID | SPECD_FILEMODE | SPECD_DIRMODE; + entry->specdFlags |= SPECD_UID | SPECD_GID | SPECD_FILEMODE | SPECD_DIRMODE; rc = RPMRC_OK; exit: @@ -1791,7 +1790,7 @@ static rpmRC processPackageFiles(rpmSpec spec, rpmBuildPkgFlags pkgFlags, fl.cur.verifyFlags = fl.def.verifyFlags; if (parseForVerify(buf, &fl.cur, &fl.def) || - parseForAttr(buf, &fl) || + parseForAttr(buf, &fl.cur, &fl.def) || parseForDev(buf, &fl) || parseForConfig(buf, &fl) || parseForLang(buf, &fl) || @@ -1921,7 +1920,7 @@ rpmRC processSourceFiles(rpmSpec spec, rpmBuildPkgFlags pkgFlags) memset(&fl, 0, sizeof(fl)); if (_srcdefattr) { char *a = rstrscat(NULL, "%defattr ", _srcdefattr, NULL); - parseForAttr(a, &fl); + parseForAttr(a, NULL, &fl.def); free(a); } fl.fileList = xcalloc((spec->numSources + 1), sizeof(*fl.fileList)); |