]> git.pld-linux.org Git - packages/rpm.git/blame - rpm-shescape-memfault.patch
- compress debuginfo sections with zlib (reduce /usr/lib/debug size).
[packages/rpm.git] / rpm-shescape-memfault.patch
CommitLineData
26a4a990
ER
1--- rpm-4.5/rpmdb/header.c~ 2009-05-13 18:25:56.000000000 +0300
2+++ rpm-4.5/rpmdb/header.c 2009-05-13 18:26:01.729564093 +0300
3@@ -2977,7 +2977,6 @@
4 static char * shescapeFormat(HE_t he, /*@null@*/ const char ** av)
5 /*@*/
6 {
7- rpmTagData data = { .ptr = he->p.ptr };
8 char * val;
9 size_t nb;
10
11@@ -2985,34 +2984,37 @@
12 if (he->t == RPM_INT32_TYPE) {
13 nb = 20;
14 val = xmalloc(nb);
15- snprintf(val, nb, "%d", data.i32p[0]);
16+ snprintf(val, nb, "%d", he->p.i32p[0]);
17 val[nb-1] = '\0';
18 } else if (he->t == RPM_INT64_TYPE) {
19 nb = 40;
20 val = xmalloc(40);
21- snprintf(val, nb, "%lld", data.i64p[0]);
22+ snprintf(val, nb, "%lld", he->p.i64p[0]);
23 val[nb-1] = '\0';
24 } else if (he->t == RPM_STRING_TYPE) {
25- const char * s = data.str;
26+ const char * s = he->p.str;
27 char * t;
28 int c;
29
30- nb = strlen(data.str) + 1;
31- /* XXX count no. of escapes instead. */
32- t = xmalloc(4 * nb + 3);
33+ nb = 0;
34+ for (s = he->p.str; (c = (int)*s) != 0; s++) {
35+ nb++;
36+ if (c == (int)'\'')
37+ nb += 3;
38+ }
39+ nb += 3;
40+ t = val = xmalloc(nb);
41 *t++ = '\'';
42- while ((c = *s++) != 0) {
43- if (c == '\'') {
44+ for (s = he->p.str; (c = (int)*s) != 0; s++) {
45+ if (c == (int)'\'') {
46 *t++ = '\'';
47 *t++ = '\\';
48 *t++ = '\'';
49 }
50- *t++ = c;
51+ *t++ = (char) c;
52 }
53 *t++ = '\'';
54 *t = '\0';
55- nb = strlen(t) + 1;
56- val = xrealloc(t, nb);
57 } else
58 val = xstrdup(_("invalid type"));
59
This page took 0.027065 seconds and 4 git commands to generate.