static void dep2strcpy(const Pool *pool, char *p, Id id, int oldrel) { while (ISRELDEP(id)) { Reldep *rd = GETRELDEP(pool, id); if (oldrel == REL_AND || oldrel == REL_OR || oldrel == REL_WITH) if (rd->flags == REL_AND || rd->flags == REL_OR || rd->flags == REL_WITH) if (oldrel != rd->flags) { *p++ = '('; dep2strcpy(pool, p, rd->name, rd->flags); p += strlen(p); strcpy(p, pool_id2rel(pool, id)); p += strlen(p); dep2strcpy(pool, p, rd->evr, rd->flags); strcat(p, ")"); return; } if (rd->flags == REL_KIND) { dep2strcpy(pool, p, rd->evr, rd->flags); p += strlen(p); *p++ = ':'; id = rd->name; oldrel = rd->flags; continue; } dep2strcpy(pool, p, rd->name, rd->flags); p += strlen(p); if (rd->flags == REL_NAMESPACE) { *p++ = '('; dep2strcpy(pool, p, rd->evr, rd->flags); strcat(p, ")"); return; } if (rd->flags == REL_FILECONFLICT) { *p = 0; return; } strcpy(p, pool_id2rel(pool, id)); p += strlen(p); id = rd->evr; oldrel = rd->flags; } strcpy(p, pool->ss.stringspace + pool->ss.strings[id]); }
const char * pool_dep2str(Pool *pool, Id id) { char *p; if (!ISRELDEP(id)) return pool->ss.stringspace + pool->ss.strings[id]; p = pool_alloctmpspace(pool, dep2strlen(pool, id) + 1); dep2strcpy(pool, p, id, 0); return p; }