Changeset: 4496a9e448e6 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4496a9e448e6 Modified Files: tools/merovingian/utils/properties.c tools/merovingian/utils/utils.c Branch: jitudf Log Message:
Merged with default branch. diffs (103 lines): diff --git a/tools/merovingian/utils/properties.c b/tools/merovingian/utils/properties.c --- a/tools/merovingian/utils/properties.c +++ b/tools/merovingian/utils/properties.c @@ -24,7 +24,7 @@ "# This file is used by monetdbd\n\n" /* these are the properties used for starting an mserver */ -static confkeyval _internal_prop_keys[PROPLENGTH] = { +static const confkeyval _internal_prop_keys[PROPLENGTH] = { {"type", NULL, 0, STR}, {"shared", NULL, 0, STR}, {"nthreads", NULL, 0, INT}, @@ -42,6 +42,20 @@ static confkeyval _internal_prop_keys[PR static pthread_mutex_t readprops_lock = PTHREAD_MUTEX_INITIALIZER; /** + * Returns true if the key is a default property. + */ +int +defaultProperty(const char *property) { + int i; + if (property == NULL) + return 0; + for (i = 0; _internal_prop_keys[i].key != NULL; i++) + if (strcmp(property, _internal_prop_keys[i].key) == 0) + return 1; + return 0; +} + +/** * Returns the currently supported list of properties. This list can be * used to read all values, modify some and write the file back again. * The returned list is malloced, the keys are a pointer to a static diff --git a/tools/merovingian/utils/utils.c b/tools/merovingian/utils/utils.c --- a/tools/merovingian/utils/utils.c +++ b/tools/merovingian/utils/utils.c @@ -96,24 +96,23 @@ readConfFileFull(confkeyval *list, FILE val = strtok(NULL, separator); /* strip trailing newline */ val = strtok(val, "\n"); - /* check if it is default property or not. those are set in a special way */ - if (defaultProperty(key)) { - if ((err = setConfValForKey(t, key, val)) != NULL) { - free(err); /* ignore, just fall back to default */ + if ((err = setConfValForKey(t, key, val)) != NULL) { + if (strstr(err, "is not recognized") == NULL) { + /* If we already have more than PROPLENGTH + * entries, ignore every ad hoc property + */ + if (cnt >= PROPLENGTH - 1) { + continue; + } + list->key = strdup(key); + list->val = strdup(val); + list->ival = 0; + list->type = STR; + list++; + cnt++; } - } else { - /* If we already have more than PROPLENGTH entries, ignore every - * ad hoc property - */ - if (cnt >= PROPLENGTH - 1) { - continue; - } - list->key = strdup(key); - list->val = strdup(val); - list->ival = 0; - list->type = STR; - list++; - cnt++; + /* else: ignore the property */ + free(err); } } } @@ -134,25 +133,6 @@ freeConfFile(confkeyval *list) { } /** - * Returns true if the key is a default property. - */ -int -defaultProperty(const char *property) { - if (property == NULL) - return 0; - return strcmp(property, "type") == 0 || - strcmp(property, "shared") == 0 || - strcmp(property, "nthreads") == 0 || - strcmp(property, "readonly") == 0 || - strcmp(property, "nclients") == 0 || - strcmp(property, "mfunnel") == 0 || - strcmp(property, "embedr") == 0 || - strcmp(property, "embedpy") == 0 || - strcmp(property, "embedpy3") == 0 || - strcmp(property, "optpipe") == 0; -} - -/** * Returns a pointer to the key-value that has a matching key with the * given key, or NULL if no key was found. */ _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list