… | |
… | |
653 | * otherwise allocates a new string and copies p2 to it |
653 | * otherwise allocates a new string and copies p2 to it |
654 | */ |
654 | */ |
655 | char * |
655 | char * |
656 | concat_line (char *p1, const char *p2) |
656 | concat_line (char *p1, const char *p2) |
657 | { |
657 | { |
658 | assert(p2); |
|
|
659 | |
|
|
660 | int l1 = p1 ? strlen (p1) : 0; |
658 | int l1 = p1 ? strlen (p1) : 0; |
661 | int l2 = strlen (p2); |
659 | int l2 = strlen (p2); |
662 | char *r; |
660 | char *r; |
|
|
661 | |
|
|
662 | assert (p2); |
663 | |
663 | |
664 | if (p1) |
664 | if (p1) |
665 | r = xrealloc(p1, l1 + l2 + 1); |
665 | r = xrealloc(p1, l1 + l2 + 1); |
666 | else |
666 | else |
667 | r = xmalloc (l2 + 1); |
667 | r = xmalloc (l2 + 1); |
… | |
… | |
923 | int start_w = log->last->wrapped_left ? continuation_width : 0; |
923 | int start_w = log->last->wrapped_left ? continuation_width : 0; |
924 | int w = start_w; |
924 | int w = start_w; |
925 | int wrapped = 0; |
925 | int wrapped = 0; |
926 | char *break_p = NULL; |
926 | char *break_p = NULL; |
927 | int width_at_break_p = 0; |
927 | int width_at_break_p = 0; |
|
|
928 | int prefix_len; |
|
|
929 | |
928 | spaces = 0; |
930 | spaces = 0; |
929 | |
931 | |
930 | if (opt_justify) |
932 | if (opt_justify) |
931 | breaks[spaces].index = breaks[spaces].width = 0; |
933 | breaks[spaces].index = breaks[spaces].width = 0; |
932 | |
934 | |
… | |
… | |
989 | /* if we're wrapping at spaces, and the line is long enough to |
991 | /* if we're wrapping at spaces, and the line is long enough to |
990 | * wrap, and we've seen a space already, and the space wasn't |
992 | * wrap, and we've seen a space already, and the space wasn't |
991 | * the first character on the line, then wrap at the space */ |
993 | * the first character on the line, then wrap at the space */ |
992 | if (!wrapped) |
994 | if (!wrapped) |
993 | break; |
995 | break; |
994 | |
|
|
995 | int prefix_len; |
|
|
996 | |
996 | |
997 | /* choose where to break the line */ |
997 | /* choose where to break the line */ |
998 | if (opt_wordwrap && break_p && break_p != beg) |
998 | if (opt_wordwrap && break_p && break_p != beg) |
999 | { |
999 | { |
1000 | prefix_len = break_p - beg; |
1000 | prefix_len = break_p - beg; |