Changeset 19d007e in mainline for uspace/lib/fmtutil/fmtutil.c


Ignore:
Timestamp:
2011-08-21T08:18:18Z (13 years ago)
Author:
Martin Sucha <sucha14@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
6045ecf
Parents:
fcfac250
Message:

Fix handling of empty lines when using ALIGN_JUSTIFY

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/fmtutil/fmtutil.c

    rfcfac250 r19d007e  
    131131                        if (!space) word_chars++;
    132132                }
    133                 if (words == 0) {
    134                         return EOK;
    135                 }
     133                size_t done_words = 0;
     134                size_t done_chars = 0;
     135                if (words == 0)
     136                        goto skip_words;
    136137                size_t excess_spaces = width - word_chars - (words-1);
    137138                space = true;
    138139                i = 0;
    139                 size_t done_words = 0;
    140                 size_t done_chars = 0;
    141140                size_t j;
    142141                while (i < len) {
     
    160159                        done_words++;
    161160                }
     161skip_words:
    162162                while (done_chars < width) {
    163163                        putchar(' ');
Note: See TracChangeset for help on using the changeset viewer.