From 7e124cf95e2a85897bd78b6362ff9b9b1b87c4b8 Mon Sep 17 00:00:00 2001 From: Siteshwar Vashisht Date: Mon, 16 Jan 2012 23:54:57 +0530 Subject: [PATCH] Added constructor to completion_t for guarranted initialzation of flags attribute. --- builtin.cpp | 3 ++- complete.cpp | 3 ++- complete.h | 4 ++++ expand.cpp | 9 ++++++--- parser.cpp | 9 ++++++--- reader.cpp | 4 ++-- wildcard.cpp | 6 ++++-- 7 files changed, 26 insertions(+), 12 deletions(-) diff --git a/builtin.cpp b/builtin.cpp index 04dafb883..be6b06bd2 100644 --- a/builtin.cpp +++ b/builtin.cpp @@ -3895,7 +3895,8 @@ void builtin_get_names( array_list_t *list ) void builtin_get_names2(std::vector &list) { for (int i=0;icompletion < rhs.completion; } bool operator == (const completion_t& rhs) const { return this->completion == rhs.completion; } bool operator != (const completion_t& rhs) const { return this->completion != rhs.completion; } diff --git a/expand.cpp b/expand.cpp index feb49cde0..90dffae1d 100644 --- a/expand.cpp +++ b/expand.cpp @@ -1380,7 +1380,8 @@ static int expand_variables2( wchar_t * in, std::vector &out, int wchar_t *next = (wchar_t *)al_get( &var_item_list, j ); if( is_ok && (i == 0) && (!in[stop_pos]) ) { - completion_t data_to_push = { next }; + completion_t data_to_push; + data_to_push.completion = next; out.push_back( data_to_push ); } else @@ -1464,7 +1465,8 @@ static int expand_variables2( wchar_t * in, std::vector &out, int if( !empty ) { - completion_t data_to_push = { in }; + completion_t data_to_push; + data_to_push.completion = in; out.push_back( data_to_push ); } else @@ -1566,7 +1568,8 @@ static int expand_brackets( wchar_t *in, int flags, std::vector &o if( bracket_begin == 0 ) { - completion_t data_to_push = { in }; + completion_t data_to_push; + data_to_push.completion = in; out.push_back( data_to_push ); return 1; } diff --git a/parser.cpp b/parser.cpp index 89a32e02f..dfcdc17b4 100644 --- a/parser.cpp +++ b/parser.cpp @@ -1944,7 +1944,8 @@ static int parse_job( process_t *p, } } } - completion_t data_to_push = { nxt }; + completion_t data_to_push; + data_to_push.completion = nxt; args->push_back( data_to_push ); } @@ -1998,9 +1999,11 @@ static int parse_job( process_t *p, // al_truncate( args, 0 ); args->clear(); // al_push( args, halloc_wcsdup( j, L"cd" ) ); - completion_t comp = { L"cd" }; + completion_t comp; + comp.completion = L"cd"; args->push_back(comp); - completion_t comp2 = { tmp }; + completion_t comp2; + comp2.completion = tmp; args->push_back( comp2 ); // free(tmp); diff --git a/reader.cpp b/reader.cpp index 552dd7fe3..8b0ad5034 100644 --- a/reader.cpp +++ b/reader.cpp @@ -1254,8 +1254,8 @@ static void run_pager( wchar_t *prefix, int is_quoted, const std::vector