some C99 changes
Instead of using index() macro defined to strchr, use C99 strchr.
Instead of using rindex() macro defined to strrchr, use C99 strrchr.
If you want to try building on a platform that doesn't offer those
two functions, these are available:
define NOT_C99 /* to make some non-C99 code available */
define NEED_INDEX /* to define a macro for index() */
define NEED_RINDX /* to define a macro for rindex() */
This commit is contained in:
+2
-2
@@ -384,7 +384,7 @@ append_text_buffer(struct text_buffer *tb, const char *str, boolean concat)
|
||||
if (tb->num_lines) { /* not first --- append a newline */
|
||||
char appchar = '\n';
|
||||
|
||||
if (concat && !index("!.?'\")", tb->text[tb->text_last - 1])) {
|
||||
if (concat && !strchr("!.?'\")", tb->text[tb->text_last - 1])) {
|
||||
appchar = ' ';
|
||||
tb->num_lines--; /* offset increment at end of function */
|
||||
}
|
||||
@@ -398,7 +398,7 @@ append_text_buffer(struct text_buffer *tb, const char *str, boolean concat)
|
||||
if (length) {
|
||||
/* Remove all newlines. Otherwise we have a confused line count. */
|
||||
copy = (tb->text + tb->text_last);
|
||||
while ((copy = index(copy, '\n')) != (char *) 0)
|
||||
while ((copy = strchr(copy, '\n')) != (char *) 0)
|
||||
*copy = ' ';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user