1
1

* src/wordproc.c (word_start): Add new argument. Pass extra argument

to next_word_start().
(next_word_start):  Add new argument to denote the maximum number of
characters to process.
(format_this): Reflect the changes above.
Этот коммит содержится в:
Pavel Tsekov 2006-06-16 19:34:49 +00:00
родитель 7115ed2243
Коммит 13884c4908
2 изменённых файлов: 18 добавлений и 13 удалений

Просмотреть файл

@ -1,3 +1,11 @@
2006-06-16 Jindrich Novy <jnovy@redhat.com>
* wordproc.c (word_start): Add new argument. Pass extra argument
to next_word_start().
(next_word_start): Add new argument to denote the maximum number
of characters to process.
(format_this): Reflect the changes above.
2006-05-04 Pavel Tsekov <ptsekov@gmx.net> 2006-05-04 Pavel Tsekov <ptsekov@gmx.net>
* choosesyntax.c (pstrcmp): Fix the function declaration. * choosesyntax.c (pstrcmp): Fix the function declaration.

Просмотреть файл

@ -198,33 +198,30 @@ static int line_pixel_length (unsigned char *t, long b, int l)
} }
static int static int
next_word_start (unsigned char *t, int q) next_word_start (unsigned char *t, int q, int size)
{ {
int i; int i;
for (i = q;; i++) { for (i = q; i < size; i++) {
switch (t[i]) { switch (t[i]) {
case '\n': case '\n':
return -1; return -1;
case '\t': case '\t':
case ' ': case ' ':
for (;; i++) { continue;
if (t[i] == '\n') default:
return -1; return i;
if (t[i] != ' ' && t[i] != '\t')
return i;
}
break;
} }
} }
return -1;
} }
/* find the start of a word */ /* find the start of a word */
static int static int
word_start (unsigned char *t, int q) word_start (unsigned char *t, int q, int size)
{ {
int i = q; int i = q;
if (t[q] == ' ' || t[q] == '\t') if (t[q] == ' ' || t[q] == '\t')
return next_word_start (t, q); return next_word_start (t, q, size);
for (;;) { for (;;) {
int c; int c;
if (!i) if (!i)
@ -253,9 +250,9 @@ static void format_this (unsigned char *t, int size, int indent)
break; break;
if (t[q] == '\n') if (t[q] == '\n')
break; break;
p = word_start (t, q); p = word_start (t, q, size);
if (p == -1) if (p == -1)
q = next_word_start (t, q); /* Return the end of the word if the beginning q = next_word_start (t, q, size); /* Return the end of the word if the beginning
of the word is at the beginning of a line of the word is at the beginning of a line
(i.e. a very long word) */ (i.e. a very long word) */
else else