continue;
for (j = 1; j < data->nkeys; j++)
{
- if (data->keys[j].name == key && (data->keys[j].type == TYPE_U32 || data->keys[j].type == TYPE_NUM))
- return repodata_lookup_num(data, n - data->start, j);
+ if (data->keys[j].name == key
+ && (data->keys[j].type == TYPE_U32
+ || data->keys[j].type == TYPE_NUM
+ || data->keys[j].type == TYPE_CONSTANT))
+ {
+ unsigned value;
+ if (repodata_lookup_num(data, n - data->start, j, &value))
+ return value;
+ }
}
}
return 0;
return (const char *)dp;
if (key->type != TYPE_ID)
return 0;
- /* id type, must either use global or local string strore*/
+ /* id type, must either use global or local string store*/
dp = data_read_id(dp, &id);
if (data->localpool)
return data->spool.stringspace + data->spool.strings[id];
}
int
-repodata_lookup_num(Repodata *data, Id entry, Id keyid)
+repodata_lookup_num(Repodata *data, Id entry, Id keyid, unsigned *value)
{
Id schema;
Repokey *key;
KeyValue kv;
unsigned char *dp;
+ *value = 0;
dp = data->incoredata + data->incoreoffset[entry];
dp = data_read_id(dp, &schema);
/* make sure the schema of this solvable contains the key */
dp = get_data(data, key, &dp);
if (!dp)
return 0;
- if (key->type == TYPE_NUM || key->type == TYPE_U32)
- {
- dp = data_fetch(dp, &kv, key);
- return kv.num;
- }
+ if (key->type == TYPE_NUM
+ || key->type == TYPE_U32
+ || key->type == TYPE_CONSTANT)
+ {
+ dp = data_fetch(dp, &kv, key);
+ *value = kv.num;
+ return 1;
+ }
return 0;
}
void repodata_search(Repodata *data, Id entry, Id keyname, int (*callback)(void *cbdata, Solvable *s, Repodata *data, struct _Repokey *key, struct _KeyValue *kv), void *cbdata);
const char *repodata_lookup_str(Repodata *data, Id entry, Id keyid);
-int repodata_lookup_num(Repodata *data, Id entry, Id keyid);
+int repodata_lookup_num(Repodata *data, Id entry, Id keyid, unsigned *value);
void repodata_extend(Repodata *data, Id p);