aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/utils/SkRTConf.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/SkRTConf.cpp')
-rw-r--r--src/utils/SkRTConf.cpp18
1 files changed, 6 insertions, 12 deletions
diff --git a/src/utils/SkRTConf.cpp b/src/utils/SkRTConf.cpp
index 2ccfd061cb..38bc64ce76 100644
--- a/src/utils/SkRTConf.cpp
+++ b/src/utils/SkRTConf.cpp
@@ -16,29 +16,23 @@ SkRTConfRegistry::SkRTConfRegistry(): fConfs(100) {
return;
}
- char *line = NULL;
- size_t n = 0;
+ char line[1024];
while (!sk_feof(fp)) {
- if (line) {
- sk_free(line);
- }
- line = NULL;
- if (sk_getline(&line, &n, fp) == -1) break;
+ if (!sk_fgets(line, sizeof(line), fp)) {
+ break;
+ }
char *commentptr = strchr(line, '#');
if (commentptr == line) {
continue;
}
if (NULL != commentptr) {
- char *tmp = (char *) sk_malloc_throw(commentptr-line+1);
- strncpy(tmp, line, commentptr-line);
- sk_free(line);
- line = tmp;
+ *commentptr = '\0';
}
- char sep[] = " \t";
+ char sep[] = " \t\r\n";
char *keyptr = strtok(line, sep);
if (!keyptr) {