s = 0;
if (have_xdata)
- {
- if (numschemata < 255)
- data.entryschemau8 = sat_calloc(numsolv, 1);
- else
- data.entryschema = sat_calloc(numsolv, sizeof(Id));
- data.incoreoffset = sat_calloc(numsolv, sizeof(Id));
- }
+ data.incoreoffset = sat_calloc(numsolv, sizeof(Id));
for (i = 0; i < numsolv; i++, s++)
{
Id *keyp;
id++;
if (have_xdata)
{
- if (data.entryschemau8)
- data.entryschemau8[i] = id;
- else
- data.entryschema[i] = id;
data.incoreoffset[i] = data.incoredatalen;
+ incore_add_id(&data, id);
}
keyp = schemadata + schemata[id];
while ((key = *keyp++) != 0)
{
/* discard data */
sat_free(data.dirpool.dirs);
- sat_free(data.entryschemau8);
- sat_free(data.entryschema);
sat_free(data.incoreoffset);
sat_free(schemata);
sat_free(schemadata);
else
data->state = REPODATA_AVAILABLE;
}
-
-
-// EOF
Id id, *keyp;
unsigned char *dp;
- if (data->entryschemau8)
- schema = data->entryschemau8[entry];
- else
- schema = data->entryschema[entry];
+ dp = data->incoredata + data->incoreoffset[entry];
+ dp = data_read_id(dp, &schema);
/* make sure the schema of this solvable contains the key */
for (keyp = data->schemadata + data->schemata[schema]; *keyp != keyid; keyp++)
if (!*keyp)
return 0;
- dp = forward_to_key(data, keyid, schema, data->incoredata + data->incoreoffset[entry]);
+ dp = forward_to_key(data, keyid, schema, dp);
key = data->keys + keyid;
dp = get_data(data, key, &dp);
if (!dp)
int stop;
KeyValue kv;
- if (data->entryschemau8)
- schema = data->entryschemau8[entry];
- else
- schema = data->entryschema[entry];
- keyp = data->schemadata + data->schemata[schema];
dp = data->incoredata + data->incoreoffset[entry];
+ dp = data_read_id(dp, &schema);
+ keyp = data->schemadata + data->schemata[schema];
if (keyname)
{
/* search in a specific key */
{
int old = data->end - data->start;
int new = p - data->end + 1;
- if (data->entryschemau8)
- {
- data->entryschemau8 = sat_realloc(data->entryschemau8, old + new);
- memset(data->entryschemau8 + old, 0, new);
- }
- if (data->entryschema)
- {
- data->entryschema = sat_realloc2(data->entryschema, old + new, sizeof(Id));
- memset(data->entryschema + old, 0, new * sizeof(Id));
- }
if (data->attrs)
{
data->attrs = sat_realloc2(data->attrs, old + new, sizeof(Id *));
{
int old = data->end - data->start;
int new = data->start - p;
- if (data->entryschemau8)
- {
- data->entryschemau8 = sat_realloc(data->entryschemau8, old + new);
- memmove(data->entryschemau8 + new, data->entryschemau8, old);
- memset(data->entryschemau8, 0, new);
- }
- if (data->entryschema)
- {
- data->entryschema = sat_realloc2(data->entryschema, old + new, sizeof(Id));
- memmove(data->entryschema + new, data->entryschema, old * sizeof(Id));
- memset(data->entryschema, 0, new * sizeof(Id));
- }
if (data->attrs)
{
data->attrs = sat_realloc2(data->attrs, old + new, sizeof(Id *));
void
repodata_internalize(Repodata *data)
{
- int i;
Repokey *key;
Id id, entry, nentry, *ida;
Id schematacache[256];
{
memset(seen, 0, data->nkeys * sizeof(Id));
sp = schema;
- if (data->entryschemau8)
- oldschema = data->entryschemau8[entry];
+ dp = data->incoredata + data->incoreoffset[entry];
+ if (data->incoredata)
+ dp = data_read_id(dp, &oldschema);
else
- oldschema = data->entryschema[entry];
+ oldschema = 0;
#if 0
fprintf(stderr, "oldschema %d\n", oldschema);
fprintf(stderr, "schemata %d\n", data->schemata[oldschema]);
}
*sp++ = 0;
if (newschema)
- {
- /* Ideally we'd like to sort the new schema here, to ensure
- schema equality independend of the ordering. We can't do that
- yet. For once see below (old ids need to come before new ids).
- An additional difficulty is that we also need to move
- the values with the keys. */
- schemaid = addschema(data, schema, schematacache);
- if (schemaid > 255 && data->entryschemau8)
- {
- data->entryschema = sat_malloc2(nentry, sizeof(Id));
- for (i = 0; i < nentry; i++)
- data->entryschema[i] = data->entryschemau8[i];
- data->entryschemau8 = sat_free(data->entryschemau8);
- }
- if (data->entryschemau8)
- data->entryschemau8[entry] = schemaid;
- else
- data->entryschema[entry] = schemaid;
- }
+ /* Ideally we'd like to sort the new schema here, to ensure
+ schema equality independend of the ordering. We can't do that
+ yet. For once see below (old ids need to come before new ids).
+ An additional difficulty is that we also need to move
+ the values with the keys. */
+ schemaid = addschema(data, schema, schematacache);
else
schemaid = oldschema;
(oX being the old keyids (possibly overwritten), and nX being
the new keyids). This rules out sorting the keyids in order
to ensure a small schema count. */
- dp = data->incoredata + data->incoreoffset[entry];
data->incoreoffset[entry] = newincore.len;
+ data_addid(&newincore, schemaid);
for (keyp = data->schemadata + data->schemata[schemaid]; *keyp; keyp++)
{
key = data->keys + *keyp;