diff options
author | Michael Schroeder <mls@suse.de> | 2013-03-20 11:26:28 +0100 |
---|---|---|
committer | Michael Schroeder <mls@suse.de> | 2013-03-20 11:26:28 +0100 |
commit | c5fbf23044ed4355692abe13fe8e591d4e22246c (patch) | |
tree | 9460e201dab451bb44929bec8495f4b823c513d1 /src/solvable.c | |
parent | ebfee3e7d80a22278d3405d7abb9e47fcba31d9e (diff) | |
download | libsolv-c5fbf23044ed4355692abe13fe8e591d4e22246c.tar.gz libsolv-c5fbf23044ed4355692abe13fe8e591d4e22246c.tar.bz2 libsolv-c5fbf23044ed4355692abe13fe8e591d4e22246c.zip |
improve pool_solvable2str output if the evr or arch is empty
Diffstat (limited to 'src/solvable.c')
-rw-r--r-- | src/solvable.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/solvable.c b/src/solvable.c index 7ac79ee..8f4b9b9 100644 --- a/src/solvable.c +++ b/src/solvable.c @@ -46,10 +46,16 @@ pool_solvable2str(Pool *pool, Solvable *s) } p = pool_alloctmpspace(pool, nl + el + al + 3); strcpy(p, n); - p[nl] = '-'; - strncpy(p + nl + 1, e, el); - p[nl + 1 + el] = '.'; - strcpy(p + nl + 1 + el + 1, a); + if (el) + { + p[nl++] = '-'; + strncpy(p + nl, e, el); + } + if (al) + { + p[nl + el] = '.'; + strcpy(p + nl + el + 1, a); + } return p; } |