From: handa Date: Thu, 7 Apr 2005 11:36:17 +0000 (+0000) Subject: (load_chartable): Fix pursing of symbol name. X-Git-Tag: REL-1-3-0~346 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=bf1183390d7bd55638124763381881f0be2af36a;p=m17n%2Fm17n-lib.git (load_chartable): Fix pursing of symbol name. --- diff --git a/src/database.c b/src/database.c index 6c6bee0..71bdcd4 100644 --- a/src/database.c +++ b/src/database.c @@ -246,13 +246,13 @@ load_chartable (FILE *fp, MSymbol type) i++, to = read_number (buf, &i); else to = from; - if (from < 0 || to < 0) - goto label_error; + if (from < 0 || to < from) + continue; while (buf[i] && isspace ((unsigned) buf[i])) i++; c = buf[i]; if (!c) - break; + continue; if (type == Mstring) { @@ -291,6 +291,18 @@ load_chartable (FILE *fp, MSymbol type) } else if (type == Msymbol) { + char *p = buf + i; + + while (! isspace (*p)) + { + if (*p == '\\' || p[1] != '\0') + { + memmove (p, p + 1, buf + len - (p + 1)); + len--; + } + p++; + } + *p = '\0'; if (! strcmp (buf + i, "nil")) val = (void *) Mnil; else