tweaks: improve three comments, and reshuffle two declarations

master
Benno Schulenberg 2020-03-03 16:41:21 +01:00
parent 9f92341c84
commit 4dab491df2
1 changed files with 8 additions and 10 deletions

View File

@ -553,8 +553,8 @@ char *parse_argument(char *ptr)
} }
#ifdef ENABLE_COLOR #ifdef ENABLE_COLOR
/* Pass over the current regex string in the line starting at ptr, /* Advance over one regular expression in the line starting at ptr,
* null-terminate it, and return a pointer to the /next/ word. */ * null-terminate it, and return a pointer to the succeeding text. */
char *parse_next_regex(char *ptr) char *parse_next_regex(char *ptr)
{ {
if (*(ptr - 1) != '"') { if (*(ptr - 1) != '"') {
@ -562,10 +562,10 @@ char *parse_next_regex(char *ptr)
return NULL; return NULL;
} }
/* Continue until the end of line, or until a " followed by a /* Continue until the end of the line, or until a double quote followed
* blank character or the end of line. */ * by end-of-line or a blank. */
while (*ptr != '\0' && (*ptr != '"' || while (*ptr != '\0' && (*ptr != '"' ||
(*(ptr + 1) != '\0' && !isblank((unsigned char)ptr[1])))) (ptr[1] != '\0' && !isblank((unsigned char)ptr[1]))))
ptr++; ptr++;
if (*ptr == '\0') { if (*ptr == '\0') {
@ -573,7 +573,7 @@ char *parse_next_regex(char *ptr)
return NULL; return NULL;
} }
/* Null-terminate and advance ptr. */ /* Null-terminate the regex and skip until the next non-blank. */
*ptr++ = '\0'; *ptr++ = '\0';
while (isblank((unsigned char)*ptr)) while (isblank((unsigned char)*ptr))
@ -1151,7 +1151,8 @@ colortype *parse_interface_color(char *combostr)
* by ptr, and store them quoteless in the passed storage place. */ * by ptr, and store them quoteless in the passed storage place. */
void grab_and_store(const char *kind, char *ptr, regexlisttype **storage) void grab_and_store(const char *kind, char *ptr, regexlisttype **storage)
{ {
regexlisttype *lastthing; regexlisttype *lastthing, *newthing;
const char *regexstring;
if (!opensyntax) { if (!opensyntax) {
jot_error(N_("A '%s' command requires a preceding 'syntax' command"), kind); jot_error(N_("A '%s' command requires a preceding 'syntax' command"), kind);
@ -1177,9 +1178,6 @@ void grab_and_store(const char *kind, char *ptr, regexlisttype **storage)
/* Now gather any valid regexes and add them to the linked list. */ /* Now gather any valid regexes and add them to the linked list. */
while (*ptr != '\0') { while (*ptr != '\0') {
const char *regexstring;
regexlisttype *newthing;
regexstring = ++ptr; regexstring = ++ptr;
ptr = parse_next_regex(ptr); ptr = parse_next_regex(ptr);