Author: matz Date: Wed Jan 30 02:13:11 2008 New Revision: 8401 URL: http://svn.opensuse.org/viewcvs/zypp?rev=8401&view=rev Log: Storing the schema in front of the incore data releaves us from fiddling with the entryschema members. Modified: trunk/sat-solver/src/repo.c trunk/sat-solver/src/repo_solv.c trunk/sat-solver/src/repodata.c trunk/sat-solver/src/repodata.h Modified: trunk/sat-solver/src/repo.c URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/repo.c?rev=8401&r1=8400&r2=8401&view=diff ============================================================================== --- trunk/sat-solver/src/repo.c (original) +++ trunk/sat-solver/src/repo.c Wed Jan 30 02:13:11 2008 @@ -775,7 +775,6 @@ data->schemadata = sat_calloc(1, sizeof(Id)); data->nschemata = 1; data->schemadatalen = 1; - data->entryschemau8 = sat_calloc(data->end - data->start, 1); data->incoreoffset = sat_calloc(data->end - data->start, sizeof(Id)); return data; } Modified: trunk/sat-solver/src/repo_solv.c URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/repo_solv.c?rev=8401&r1=8400&r2=8401&view=diff ============================================================================== --- trunk/sat-solver/src/repo_solv.c (original) +++ trunk/sat-solver/src/repo_solv.c Wed Jan 30 02:13:11 2008 @@ -1056,13 +1056,7 @@ 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; @@ -1075,11 +1069,8 @@ 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) @@ -1333,8 +1324,6 @@ { /* 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); @@ -1389,6 +1378,3 @@ else data->state = REPODATA_AVAILABLE; } - - -// EOF Modified: trunk/sat-solver/src/repodata.c URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/repodata.c?rev=8401&r1=8400&r2=8401&view=diff ============================================================================== --- trunk/sat-solver/src/repodata.c (original) +++ trunk/sat-solver/src/repodata.c Wed Jan 30 02:13:11 2008 @@ -408,15 +408,13 @@ 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) @@ -443,12 +441,9 @@ 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 */ @@ -492,16 +487,6 @@ { 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 *)); @@ -515,18 +500,6 @@ { 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 *)); @@ -827,7 +800,6 @@ void repodata_internalize(Repodata *data) { - int i; Repokey *key; Id id, entry, nentry, *ida; Id schematacache[256]; @@ -855,10 +827,11 @@ { 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]); @@ -889,25 +862,12 @@ } *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; @@ -919,8 +879,8 @@ (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; Modified: trunk/sat-solver/src/repodata.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/repodata.h?rev=8401&r1=8400&r2=8401&view=diff ============================================================================== --- trunk/sat-solver/src/repodata.h (original) +++ trunk/sat-solver/src/repodata.h Wed Jan 30 02:13:11 2008 @@ -58,9 +58,6 @@ Id *schemadata; /* schema storage */ unsigned int schemadatalen; /* schema storage size */ - unsigned char *entryschemau8; /* schema for entry */ - Id *entryschema; /* schema for entry */ - Stringpool spool; /* local string pool */ int localpool; /* is local string pool used */ -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org