summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: cff7e32)
raw | patch | inline | side by side (parent: cff7e32)
author | Florian Forster <ff@octo.it> | |
Wed, 28 Jul 2010 16:02:26 +0000 (18:02 +0200) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Wed, 28 Jul 2010 16:02:26 +0000 (18:02 +0200) |
src/graph_instance.c | patch | blob | history |
diff --git a/src/graph_instance.c b/src/graph_instance.c
index 5ca8c66ab854250fe0169357e815a67dd783af18..86cec84c832fa8ccb02afd926a16e5da13e9f89c 100644 (file)
--- a/src/graph_instance.c
+++ b/src/graph_instance.c
buffer[0] = 0;
+#define COPY_ESCAPE(str) do { \
+ char tmp[1024]; \
+ uri_escape_copy (tmp, (str), sizeof (tmp)); \
+ strlcat (buffer, tmp, buffer_size); \
+} while (0) \
+
#define COPY_FIELD(field) do { \
const char *cfg_f = ident_get_##field (cfg_select); \
const char *inst_f = ident_get_##field (inst->select); \
{ \
strlcat (buffer, #field, buffer_size); \
strlcat (buffer, "=", buffer_size); \
- strlcat (buffer, cfg_f, buffer_size); \
+ COPY_ESCAPE (cfg_f); \
} \
else \
{ \
strlcat (buffer, "graph_", buffer_size); \
strlcat (buffer, #field, buffer_size); \
strlcat (buffer, "=", buffer_size); \
- strlcat (buffer, cfg_f, buffer_size); \
+ COPY_ESCAPE (cfg_f); \
strlcat (buffer, ";", buffer_size); \
strlcat (buffer, "inst_", buffer_size); \
strlcat (buffer, #field, buffer_size); \
strlcat (buffer, "=", buffer_size); \
- strlcat (buffer, inst_f, buffer_size); \
+ COPY_ESCAPE (inst_f); \
} \
} while (0)
COPY_FIELD(type_instance);
#undef COPY_FIELD
+#undef COPY_ESCAPE
ident_destroy (cfg_select);