aboutsummaryrefslogtreecommitdiffhomepage
path: root/wildcard.cpp
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-02-09 10:14:06 -0800
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-02-09 10:14:06 -0800
commitf1b1d1ca7526dd9797b9f406e2351b8a9fbacbdf (patch)
treecf66553a9f65b0a1d6b758e7de59f12f49da8aee /wildcard.cpp
parente5bba2294dfd0d56ee5b1c7ac4b9060873b8b03a (diff)
Get rid of some string buffer
Diffstat (limited to 'wildcard.cpp')
-rw-r--r--wildcard.cpp24
1 files changed, 7 insertions, 17 deletions
diff --git a/wildcard.cpp b/wildcard.cpp
index aba13ae2..6bc5a138 100644
--- a/wildcard.cpp
+++ b/wildcard.cpp
@@ -628,7 +628,7 @@ static void wildcard_completion_allocate( std::vector<completion_t> &list,
{
const wchar_t *desc;
struct stat buf, lbuf;
- static string_buffer_t *sb = 0;
+ wcstring sb;
int free_completion = 0;
@@ -638,18 +638,7 @@ static void wildcard_completion_allocate( std::vector<completion_t> &list,
long long sz;
- if( !sb )
- {
- sb = sb_halloc( global_context );
- }
- else
- {
- sb_clear( sb );
- }
-
CHECK( fullname, );
-
- sb_clear( sb );
/*
If the file is a symlink, we need to stat both the file itself
@@ -697,15 +686,16 @@ static void wildcard_completion_allocate( std::vector<completion_t> &list,
free_completion = 1;
flags = flags | COMPLETE_NO_SPACE;
completion = wcsdupcat( completion, L"/" );
- sb_append( sb, desc );
+ sb.append(desc);
}
else
- {
- sb_append( sb, desc, L", ", NULL );
- sb_format_size( sb, sz );
+ {
+ sb.append(desc);
+ sb.append(L", ");
+ sb.append(format_size(sz));
}
- wildcard_complete( completion, wc, (wchar_t *)sb->buff, 0, list, flags );
+ wildcard_complete( completion, wc, sb.c_str(), NULL, list, flags );
if( free_completion )
free( (void *)completion );
}