aboutsummaryrefslogtreecommitdiffhomepage
path: root/fish_pager.cpp
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-03-04 02:45:51 -0800
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-03-04 02:45:51 -0800
commit2c5001a5b3833d40375503eabacfbeb4ad636c8d (patch)
treedef8f2e010471fdc6828556c5d9b2cafe8547554 /fish_pager.cpp
parent191221eec575cee682aed01e285aa95a5a2969cb (diff)
Removed buffer_t
Diffstat (limited to 'fish_pager.cpp')
-rw-r--r--fish_pager.cpp20
1 files changed, 6 insertions, 14 deletions
diff --git a/fish_pager.cpp b/fish_pager.cpp
index 2c7db065..8c81e138 100644
--- a/fish_pager.cpp
+++ b/fish_pager.cpp
@@ -1113,16 +1113,13 @@ static void destroy()
*/
static void read_array( FILE* file, wcstring_list_t &comp )
{
- buffer_t buffer;
+ std::vector<char> buffer;
int c;
- char cc;
wchar_t *wcs;
- b_init( &buffer );
-
while( !feof( file ) )
{
- buffer.used=0;
+ buffer.clear();
while( 1 )
{
@@ -1137,17 +1134,14 @@ static void read_array( FILE* file, wcstring_list_t &comp )
break;
}
- cc=c;
-
- b_append( &buffer, &cc, 1 );
+ buffer.push_back(static_cast<char>(c));
}
- if( buffer.used )
+ if( ! buffer.empty() )
{
- cc=0;
- b_append( &buffer, &cc, 1 );
+ buffer.push_back(0);
- wcs = str2wcs( buffer.buff );
+ wcs = str2wcs( &buffer.at(0) );
if( wcs )
{
wcstring tmp = wcs;
@@ -1160,8 +1154,6 @@ static void read_array( FILE* file, wcstring_list_t &comp )
}
}
- b_destroy( &buffer );
-
}
static int get_fd( const char *str )