From 2fa95b180c53660c7d303eb380943096ade2ee6f Mon Sep 17 00:00:00 2001 From: ketmar Date: Mon, 29 Jul 2013 18:59:35 +0000 Subject: [PATCH] drkin fix FossilOrigin-Name: ee836d5ed4bfaeefbadf52c6d817371aaf3fc9e96b641e09abd4fde643c12db3 --- src/tagscan.c | 44 ++++++++++++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/src/tagscan.c b/src/tagscan.c index 013230f..8c6a216 100644 --- a/src/tagscan.c +++ b/src/tagscan.c @@ -409,6 +409,30 @@ static char *w2u (const char *str, int justcheck) { //////////////////////////////////////////////////////////////////////////////// +static char *fix_venya (char *s) { + //k8 hack + //if (strstr(s, "venya") == NULL) return s; + //fprintf(stderr, "VVV: [%s]\n", s); + for (;;) { + char *t = strstr(s, "d_rkin"); + if (t == NULL) break; + //fprintf(stderr, "V0: [%s] -> [", s); + memmove(t+1, t+2, strlen(t+2)+1); + //fprintf(stderr, "%s]\n", s); + } + //k8 hack + for (;;) { + char *t = strstr(s, "venya_drkin"); + if (t == NULL) break; + //fprintf(stderr, "V1: [%s] -> [", s); + memmove(t, t+6, strlen(t+6)+1); + //fprintf(stderr, "%s]\n", s); + } + // + return s; +} + + static char *str_convert (const char *str, const char *def, const char *fname, int toutf) { const char *ostr = str; char *ss, *s; @@ -449,21 +473,8 @@ static char *str_convert (const char *str, const char *def, const char *fname, i return NULL; } strncpy(res, s, sizeof(res)-1); - //k8 hack - for (;;) { - char *t = strstr(res, "dr_kin"); - if (t == NULL) break; - t += 2; // "_" - memmove(t, t+1, strlen(t+1)+1); - } - //k8 hack - for (;;) { - char *t = strstr(res, "venya_drkin"); - if (t == NULL) break; - memmove(t, t+6, strlen(t+6)+1); - } // - return res; + return fix_venya(res); } @@ -656,6 +667,11 @@ static mtagvalue_t *tag_add (const char *str, const char *def, string_t *oval, i str = s; dofree = 1; } + if (!dofree) { + str = strdup(str); + dofree = 1; + } + fix_venya((char *)str); value = cstring_add(str); HASH_FIND_PTR(taglist, &value, tv); if (tv == NULL) { -- 2.11.4.GIT