diff options
author | Thomas Haller <thaller@redhat.com> | 2017-02-21 15:47:43 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2017-02-21 15:47:43 +0100 |
commit | 8406455b4d94324a77e81f2fc14110f335c3d1f4 (patch) | |
tree | 8bdf5f47947d2f9ad24a013323fb1d892e097aa4 | |
parent | c9f6cb9fe4234c5c6b2b187cddca9ad77ac84c64 (diff) | |
download | NetworkManager-8406455b4d94324a77e81f2fc14110f335c3d1f4.tar.gz |
ifcfg: drop strlen() call from svEscape()
-rw-r--r-- | src/settings/plugins/ifcfg-rh/shvar.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/settings/plugins/ifcfg-rh/shvar.c b/src/settings/plugins/ifcfg-rh/shvar.c index 619a54afb8..a058657932 100644 --- a/src/settings/plugins/ifcfg-rh/shvar.c +++ b/src/settings/plugins/ifcfg-rh/shvar.c @@ -220,14 +220,12 @@ svEscape (const char *s, char **to_free) int newlen; size_t i, j, slen; - slen = strlen (s); - - for (i = 0; i < slen; i++) { - if (_char_req_escape (s[i])) + for (slen = 0; s[slen]; slen++) { + if (_char_req_escape (s[slen])) mangle++; - else if (_char_req_quotes (s[i])) + else if (_char_req_quotes (s[slen])) requires_quotes = TRUE; - else if (s[i] < ' ') { + else if (s[slen] < ' ') { /* if the string contains newline we can only express it using ANSI C quotation * (as we don't support line continuation). * Additionally, ANSI control characters look odd with regular quotation, so handle |