diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2016-12-15 09:12:46 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2016-12-15 09:12:46 +0100 |
commit | 2183181a37a0d2748ec5249802431d7634dee3bb (patch) | |
tree | 898265b12ecb88c220745e02aa74f3f8af2a2443 /src | |
parent | f73bfdc31b21e34ba1bd6338e01be3af6c3cb89e (diff) | |
parent | cce716909e5236f1aa2971a4db45a007c7efe416 (diff) |
Merge tag 'upstream/6.1.3'
Upstream version 6.1.3
Diffstat (limited to 'src')
-rw-r--r-- | src/.gitignore | 1 | ||||
-rw-r--r-- | src/mktable.c | 42 | ||||
-rw-r--r-- | src/oniguruma.h | 2 | ||||
-rw-r--r-- | src/st.c | 19 |
4 files changed, 49 insertions, 15 deletions
diff --git a/src/.gitignore b/src/.gitignore index e9781fc..50ae793 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -12,3 +12,4 @@ UNICODE_PROPERTIES *.txt .libs/ .deps/ +/mktable diff --git a/src/mktable.c b/src/mktable.c index 285216e..a9cac2c 100644 --- a/src/mktable.c +++ b/src/mktable.c @@ -2,7 +2,7 @@ mktable.c **********************************************************************/ /*- - * Copyright (c) 2002-2007 K.Kosako <sndgk393 AT ybb DOT ne DOT jp> + * Copyright (c) 2002-2016 K.Kosako <sndgk393 AT ybb DOT ne DOT jp> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -31,7 +31,10 @@ #include <stdio.h> #include <locale.h> +#ifndef __USE_ISOC99 #define __USE_ISOC99 +#endif + #include <ctype.h> #include "regenc.h" @@ -1108,11 +1111,13 @@ static int exec(FILE* fp, ENC_INFO* einfo) #define NCOL 8 int c, val, enc; + int r; enc = einfo->num; - fprintf(fp, "static const unsigned short Enc%s_CtypeTable[256] = {\n", - einfo->name); + r = fprintf(fp, "static const unsigned short Enc%s_CtypeTable[256] = {\n", + einfo->name); + if (r < 0) return -1; for (c = 0; c < 256; c++) { val = 0; @@ -1131,20 +1136,33 @@ static int exec(FILE* fp, ENC_INFO* einfo) if (IsWord (enc, c)) val |= BIT_CTYPE_WORD; if (IsAscii (enc, c)) val |= BIT_CTYPE_ASCII; - if (c % NCOL == 0) fputs(" ", fp); - fprintf(fp, "0x%04x", val); - if (c != 255) fputs(",", fp); + if (c % NCOL == 0) { + r = fputs(" ", fp); + if (r < 0) return -1; + } + r = fprintf(fp, "0x%04x", val); + if (r < 0) return -1; + + if (c != 255) { + r = fputs(",", fp); + if (r < 0) return -1; + } if (c != 0 && c % NCOL == (NCOL-1)) - fputs("\n", fp); + r = fputs("\n", fp); else - fputs(" ", fp); + r = fputs(" ", fp); + + if (r < 0) return -1; } - fprintf(fp, "};\n"); + r = fprintf(fp, "};\n"); + if (r < 0) return -1; + return 0; } extern int main(int argc ARG_UNUSED, char* argv[] ARG_UNUSED) { + int r; int i; FILE* fp = stdout; @@ -1155,7 +1173,11 @@ extern int main(int argc ARG_UNUSED, char* argv[] ARG_UNUSED) /* setlocale(LC_ALL, "fr_FR.iso88591"); */ for (i = 0; i < (int )(sizeof(Info)/sizeof(ENC_INFO)); i++) { - exec(fp, &Info[i]); + r = exec(fp, &Info[i]); + if (r < 0) { + fprintf(stderr, "FAIL exec(): %d\n", r); + return -1; + } } return 0; diff --git a/src/oniguruma.h b/src/oniguruma.h index 6090165..090b809 100644 --- a/src/oniguruma.h +++ b/src/oniguruma.h @@ -36,7 +36,7 @@ extern "C" { #define ONIGURUMA #define ONIGURUMA_VERSION_MAJOR 6 #define ONIGURUMA_VERSION_MINOR 1 -#define ONIGURUMA_VERSION_TEENY 2 +#define ONIGURUMA_VERSION_TEENY 3 #ifdef __cplusplus # ifndef HAVE_PROTOTYPES @@ -130,11 +130,13 @@ static int collision = 0; static int init_st = 0; static void -stat_col() +stat_col(void) { - FILE *f = fopen("/tmp/col", "w"); - fprintf(f, "collision: %d\n", collision); - fclose(f); + FILE *f = fopen("/tmp/col", "w"); + if (f == 0) return ; + + (void) fprintf(f, "collision: %d\n", collision); + (void) fclose(f); } #endif @@ -155,10 +157,16 @@ st_init_table_with_size(type, size) size = new_size(size); /* round up to prime number */ tbl = alloc(st_table); + if (tbl == 0) return 0; + tbl->type = type; tbl->num_entries = 0; tbl->num_bins = size; tbl->bins = (st_table_entry **)Calloc(size, sizeof(st_table_entry*)); + if (tbl->bins == 0) { + free(tbl); + return 0; + } return tbl; } @@ -320,6 +328,9 @@ rehash(table) new_num_bins = new_size(old_num_bins+1); new_bins = (st_table_entry**)Calloc(new_num_bins, sizeof(st_table_entry*)); + if (new_bins == 0) { + return ; + } for(i = 0; i < old_num_bins; i++) { ptr = table->bins[i]; |