-#if 0
- /* Build the prefix-encoding of the string pool. We need to know
- the size of that before writing it to the file, so we have to
- build a separate buffer for that. As it's temporarily possible
- that this actually is an expansion we can't easily reuse the
- stringspace for this. The max expansion per string is 1 byte,
- so it will fit into sizeid+nstrings bytes. */
- char *prefix = solv_malloc(sizeid + nstrings);
- char *pp = prefix;
- char *old_str = "";
- for (i = 1; i < nstrings; i++)
- {
- char *str = spool->stringspace + spool->strings[needid[i].map];
- int same;
- size_t len;
- for (same = 0; same < 255; same++)
- if (!old_str[same] || !str[same] || old_str[same] != str[same])
- break;
- *pp++ = same;
- len = strlen(str + same) + 1;
- memcpy(pp, str + same, len);
- pp += len;
- old_str = str;
- }
-
- /*
- * write strings
- */
- write_u32(fp, sizeid);
- write_u32(fp, pp - prefix);
- if (pp != prefix)
- {
- if (fwrite(prefix, pp - prefix, 1, fp) != 1)
+ /*
+ * write strings
+ */
+ write_u32(&target, sizeid);
+ /* we save compsum bytes but need 1 extra byte for every string */
+ write_u32(&target, sizeid + nstrings - 1 - compsum);
+ for (i = 1; i < nstrings; i++)