comparison th_string.c @ 322:78825ff74195

Rename a variable.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 23 Feb 2016 10:36:24 +0200
parents f7d72b7bebf3
children 63c5b1bf8b98
comparison
equal deleted inserted replaced
321:f7d72b7bebf3 322:78825ff74195
223 223
224 224
225 static int th_printf_vput_str(th_printf_ctx *ctx, th_printf_vputch vputch, 225 static int th_printf_vput_str(th_printf_ctx *ctx, th_printf_vputch vputch,
226 const char *str, int f_flags, const int f_width, const int f_prec) 226 const char *str, int f_flags, const int f_width, const int f_prec)
227 { 227 {
228 int nwidth, slen, ret = 0; 228 int nwidth, f_len, ret = 0;
229 229
230 f_flags &= ~TH_PF_ZERO; 230 f_flags &= ~TH_PF_ZERO;
231 231
232 // Check for null strings 232 // Check for null strings
233 if (str == NULL) 233 if (str == NULL)
234 str = "(null)"; 234 str = "(null)";
235 235
236 slen = strlen(str); 236 f_len = strlen(str);
237 if (f_prec >= 0 && slen > f_prec) 237 if (f_prec >= 0 && f_len > f_prec)
238 slen = f_prec; 238 f_len = f_prec;
239 239
240 nwidth = f_width - slen; 240 nwidth = f_width - f_len;
241 241
242 // Prefix padding? 242 // Prefix padding?
243 if ((ret = th_printf_pad_pre(ctx, vputch, nwidth, f_flags)) == EOF) 243 if ((ret = th_printf_pad_pre(ctx, vputch, nwidth, f_flags)) == EOF)
244 goto out; 244 goto out;
245 245
246 while (*str && slen--) 246 while (*str && f_len--)
247 { 247 {
248 if ((ret = vputch(ctx, *str++)) == EOF) 248 if ((ret = vputch(ctx, *str++)) == EOF)
249 goto out; 249 goto out;
250 } 250 }
251 251