summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Millwood <thebenmachine@gmail.com>2010-07-01 22:26:22 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:17:38 +0000
commit4464938e652c41e4cb4e59cce1fdbb069c1c3c15 (patch)
treecabd1962feba5fb8450f9a9f40c936917dd58c8e
parentb00a7ebe1cfc0e74932173556b64962a4ebd5691 (diff)
* (bug 4541) optimise Q_StripIndentMarker (thanks gimhael)
-rw-r--r--src/qcommon/q_shared.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/qcommon/q_shared.c b/src/qcommon/q_shared.c
index 59ddf2ed..ce28f953 100644
--- a/src/qcommon/q_shared.c
+++ b/src/qcommon/q_shared.c
@@ -937,17 +937,14 @@ int Q_CountChar(const char *string, char tocount)
void Q_StripIndentMarker(char *string)
{
- int i;
-
- for (i = 0; i < strlen(string); i++) {
- if (string[i] == INDENT_MARKER) {
- int j;
+ int i, j;
- for (j = i; j < strlen(string); j++) {
- string[j] = string[j+1];
- }
+ for (i = j = 0; string[i]; i++) {
+ if (string[i] != INDENT_MARKER) {
+ string[j++] = string[i];
}
}
+ string[j] = 0;
}
void Q_ParseNewlines( char *dest, const char *src, int destsize )