-#define MUSCLE_USER_NAME_CONVERT(NAME, PREFIX, USER_NAME, SUFFIX) \
-do { \
- char *tmp; \
- size_t length = strlen ((USER_NAME)); \
- tmp = xmalloc (sizeof (PREFIX) - 1 + length + sizeof (SUFFIX)); \
- strcpy (tmp, (PREFIX)); \
- strcpy (tmp + sizeof (PREFIX) - 1, (USER_NAME)); \
- strcpy (tmp + sizeof (PREFIX) - 1 + length, (SUFFIX)); \
- (NAME) = uniqstr_new (tmp); \
- free (tmp); \
-} while (0)
+/** If the \a variable name is obsolete, return the name to use,
+ * otherwise \a variable. */
+static
+char const *
+muscle_percent_variable_update (char const *variable)
+{
+ typedef struct
+ {
+ const char *obsolete;
+ const char *updated;
+ } conversion_type;
+ const conversion_type conversion[] =
+ {
+ { "api.push_pull", "api.push-pull", },
+ { "lr.keep_unreachable_states", "lr.keep-unreachable-states", },
+ { "namespace", "api.namespace", },
+ };
+ int i;
+ for (i = 0; i < sizeof conversion / sizeof *conversion; ++i)
+ if (STREQ (conversion[i].obsolete, variable))
+ return conversion[i].updated;
+ return variable;
+}