@@ -882,8 +882,8 @@ static int table_data_requested_width(TableData *d, size_t *ret) {
882882 return 0 ;
883883}
884884
885- static char * align_string_mem (const char * str , size_t old_length , size_t new_length , unsigned percent ) {
886- size_t w = 0 , space , lspace ;
885+ static char * align_string_mem (const char * str , size_t new_length , unsigned percent ) {
886+ size_t w = 0 , space , lspace , old_length ;
887887 const char * p ;
888888 char * ret ;
889889 size_t i ;
@@ -893,8 +893,7 @@ static char *align_string_mem(const char *str, size_t old_length, size_t new_len
893893 assert (str );
894894 assert (percent <= 100 );
895895
896- if (old_length == (size_t ) -1 )
897- old_length = strlen (str );
896+ old_length = strlen (str );
898897
899898 /* Determine current width on screen */
900899 p = str ;
@@ -1174,7 +1173,7 @@ int table_print(Table *t, FILE *f) {
11741173 if (l > width [j ]) {
11751174 /* Field is wider than allocated space. Let's ellipsize */
11761175
1177- buffer = ellipsize_mem (field , ( size_t ) -1 , width [j ], d -> ellipsize_percent );
1176+ buffer = ellipsize (field , width [j ], d -> ellipsize_percent );
11781177 if (!buffer )
11791178 return - ENOMEM ;
11801179
@@ -1183,7 +1182,7 @@ int table_print(Table *t, FILE *f) {
11831182 } else if (l < width [j ]) {
11841183 /* Field is shorter than allocated space. Let's align with spaces */
11851184
1186- buffer = align_string_mem (field , ( size_t ) -1 , width [j ], d -> align_percent );
1185+ buffer = align_string_mem (field , width [j ], d -> align_percent );
11871186 if (!buffer )
11881187 return - ENOMEM ;
11891188
0 commit comments