_alpm_lstat: only duplicate string if necessary
commit9d6568da0f55fb05ea5c28e06efb51046fd270bf
authorDan McGee <dan@archlinux.org>
Thu, 9 Jun 2011 18:34:13 +0000 (9 13:34 -0500)
committerDan McGee <dan@archlinux.org>
Thu, 9 Jun 2011 19:14:55 +0000 (9 14:14 -0500)
tree6ca9f8c19159ca26c81b07c3fc55ee3ae65f7757
parent451cd2c88dcdec793ce7159331adcc2d049381e1
_alpm_lstat: only duplicate string if necessary

The vast majority of the time we will just be passing the same string
value on to the lstat() call. The only time we need to duplicate it is
if the path ends in '/'. In one run using a profiler, only 400 of the
200,000 calls (0.2%) required the string to be copied first.

Signed-off-by: Dan McGee <dan@archlinux.org>
lib/libalpm/util.c