@@ -410,8 +410,6 @@ void pp_user_info(const struct pretty_print_context *pp,
410
410
const char * what , struct strbuf * sb ,
411
411
const char * line , const char * encoding )
412
412
{
413
- struct strbuf name ;
414
- struct strbuf mail ;
415
413
struct ident_split ident ;
416
414
char * line_end ;
417
415
const char * mailbuf , * namebuf ;
@@ -433,42 +431,33 @@ void pp_user_info(const struct pretty_print_context *pp,
433
431
if (pp -> mailmap )
434
432
map_user (pp -> mailmap , & mailbuf , & maillen , & namebuf , & namelen );
435
433
436
- strbuf_init (& mail , 0 );
437
- strbuf_init (& name , 0 );
438
-
439
- strbuf_add (& mail , mailbuf , maillen );
440
- strbuf_add (& name , namebuf , namelen );
441
-
442
434
if (pp -> fmt == CMIT_FMT_EMAIL ) {
443
435
strbuf_addstr (sb , "From: " );
444
- if (needs_rfc2047_encoding (name . buf , name . len , RFC2047_ADDRESS )) {
445
- add_rfc2047 (sb , name . buf , name . len ,
436
+ if (needs_rfc2047_encoding (namebuf , namelen , RFC2047_ADDRESS )) {
437
+ add_rfc2047 (sb , namebuf , namelen ,
446
438
encoding , RFC2047_ADDRESS );
447
439
max_length = 76 ; /* per rfc2047 */
448
- } else if (needs_rfc822_quoting (name . buf , name . len )) {
440
+ } else if (needs_rfc822_quoting (namebuf , namelen )) {
449
441
struct strbuf quoted = STRBUF_INIT ;
450
- add_rfc822_quoted (& quoted , name . buf , name . len );
442
+ add_rfc822_quoted (& quoted , namebuf , namelen );
451
443
strbuf_add_wrapped_bytes (sb , quoted .buf , quoted .len ,
452
444
-6 , 1 , max_length );
453
445
strbuf_release (& quoted );
454
446
} else {
455
- strbuf_add_wrapped_bytes (sb , name . buf , name . len ,
447
+ strbuf_add_wrapped_bytes (sb , namebuf , namelen ,
456
448
-6 , 1 , max_length );
457
449
}
458
450
459
451
if (max_length <
460
452
last_line_length (sb ) + strlen (" <" ) + maillen + strlen (">" ))
461
453
strbuf_addch (sb , '\n' );
462
- strbuf_addf (sb , " <%s>\n" , mail . buf );
454
+ strbuf_addf (sb , " <%.* s>\n" , ( int ) maillen , mailbuf );
463
455
} else {
464
- strbuf_addf (sb , "%s: %.*s%s <%s>\n" , what ,
465
- (pp -> fmt == CMIT_FMT_FULLER ) ? 4 : 0 ,
466
- " " , name . buf , mail . buf );
456
+ strbuf_addf (sb , "%s: %.*s%.* s <%.* s>\n" , what ,
457
+ (pp -> fmt == CMIT_FMT_FULLER ) ? 4 : 0 , " " ,
458
+ ( int ) namelen , namebuf , ( int ) maillen , mailbuf );
467
459
}
468
460
469
- strbuf_release (& mail );
470
- strbuf_release (& name );
471
-
472
461
switch (pp -> fmt ) {
473
462
case CMIT_FMT_MEDIUM :
474
463
strbuf_addf (sb , "Date: %s\n" ,
0 commit comments