X-Git-Url: http://git.draconx.ca/gitweb/gob-dx.git/blobdiff_plain/308dc7bdfb924370cfd205f656eb0e83191d01a9..4d534c82fb65897999ade6867534ab952a9bc019:/src/util.c diff --git a/src/util.c b/src/util.c index 38dd535..4d42440 100644 --- a/src/util.c +++ b/src/util.c @@ -101,8 +101,18 @@ replace_sep(const char *base, char r) if (for_cpp && strstr (s, "::") != NULL) return s; - while((p=strchr(s,':'))) - *p = r; + if (r == '\0') { + while ((p=strchr(s,':')) != NULL) { + char *t = p; + while (*t != '\0') { + *t = *(t+1); + t++; + } + } + } else { + while ((p=strchr(s,':')) != NULL) + *p = r; + } if(*s == r) { p = g_strdup(s+1); g_free(s); @@ -258,7 +268,10 @@ get_cast (const char *type, gboolean simple_only) init_type_hash (); - gtype = g_hash_table_lookup (type_hash, type); + if(strncmp(type, "BOXED_", 6) == 0) + gtype = g_hash_table_lookup (type_hash, "BOXED"); + else + gtype = g_hash_table_lookup (type_hash, type); if (gtype == NULL || (simple_only && @@ -390,3 +403,17 @@ gob_strdown (char *str) return str; } +char * +make_me_type (const char *type, const char *alt) +{ + if (type == NULL) + return g_strdup (alt); + /* HACK! just in case someone made this + * work with 2.0.0 by using the TYPE + * macro directly */ + if ((strstr (type, "_TYPE_") != NULL || + strstr (type, "TYPE_") == type) && + strchr (type, ':') == NULL) + return g_strdup (type); + return make_pre_macro (type, "TYPE"); +}