}
static inline int
-maybe_load_repodata(Repodata *data)
+maybe_load_repodata(Repodata *data, Id *keyid)
{
if (data->state == REPODATA_STUB)
{
if (data->loadcallback)
- data->loadcallback(data);
+ {
+ if (keyid)
+ {
+ /* key order may change when loading */
+ int i;
+ Id name = data->keys[*keyid].name;
+ Id type = data->keys[*keyid].type;
+ data->loadcallback(data);
+ if (data->state == REPODATA_AVAILABLE)
+ {
+ for (i = 1; i < data->nkeys; i++)
+ if (data->keys[i].name == name && data->keys[i].type == type)
+ break;
+ if (i < data->nkeys)
+ *keyid = i;
+ else
+ return 0;
+ }
+ }
+ else
+ data->loadcallback(data);
+ }
else
data->state = REPODATA_ERROR;
}
Id id, *keyp;
unsigned char *dp;
- if (!maybe_load_repodata (data))
+ if (!maybe_load_repodata(data, &keyid))
return 0;
dp = data->incoredata + data->incoreoffset[entry];
*value = 0;
- if (!maybe_load_repodata (data))
+ if (!maybe_load_repodata(data, &keyid))
return 0;
dp = data->incoredata + data->incoreoffset[entry];
int stop;
KeyValue kv;
- if (!maybe_load_repodata (data))
+ if (!maybe_load_repodata(data, 0))
return;
dp = data->incoredata + data->incoreoffset[entry];