spool->stringspace = solv_malloc(7);
strcpy(spool->stringspace, "<NULL>");
spool->sstrings = 7;
- spool->nstrings = 0;
+ spool->nstrings = numid < 2 ? 2 - numid : 0; /* make sure we have at least id 0 and 1 */
}
/* alloc string buffer */
{
/* no shared pool, thus no idmap and no unification */
idmap = 0;
- spool->nstrings = numid;
- str[0] = 0;
+ spool->nstrings = numid >= 2 ? numid : 2; /* make sure we have at least id 0 and 1 */
+ str[0] = 0; /* <NULL> */
if (*sp)
{
/* we need the '' for directories */
}
for (i = 1; i < spool->nstrings; i++)
{
- if (sp >= strsp + sizeid)
+ if (sp >= strsp + sizeid && numid >= 2)
return pool_error(pool, SOLV_ERROR_OVERFLOW, "not enough strings");
str[i] = sp - spool->stringspace;
sp += strlen(sp) + 1;
spool->stringhashmask = 0;
}
}
- pool_shrink_strings(pool); /* vacuum */
+ stringpool_shrink(spool); /* vacuum */
/******* Part 2: Relation IDs ***************************************/