]> code.citadel.org Git - citadel.git/blobdiff - citadel/utils/ctdlload.c
ctdldump/ctdlload: fixed on Raspberry Pi, reintroduced to build
[citadel.git] / citadel / utils / ctdlload.c
index 80f00bd9866165933bc35d4f07775311af931d4b..b8c4e2aec84b60811c987ada4030687312f6f16a 100644 (file)
@@ -34,7 +34,7 @@ void *reallok(void *ptr, size_t size) {
        void *p = realloc(ptr, size);
        if (!p) {
                fprintf(stderr, "realloc() failed to resize %p to %ld bytes, error: %m\n", ptr, size);
-               exit(1);
+               abort();
        }
        return p;
 }
@@ -351,8 +351,9 @@ int convert_floor(char *line, DBT *out_key, DBT *out_data) {
 // msglist|26|32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51|
 int convert_msglist(char *line, DBT *out_key, DBT *out_data) {
        long roomnum;
-       char *token;
+       char *token, *mtoken;
        char *p = line;
+       char *q = NULL;
        int num_msgs = 0;
        long *msglist = NULL;
 
@@ -362,8 +363,7 @@ int convert_msglist(char *line, DBT *out_key, DBT *out_data) {
                                roomnum = atol(token);
                                break;
                        case 2:
-                               char *q = token;
-                               char *mtoken;
+                               q = token;
                                for (int j=0; (mtoken = strsep(&q, ",")); ++j) {
                                        msglist = realloc(msglist, (num_msgs+1) * sizeof(long));
                                        msglist[num_msgs++] = atol(mtoken);
@@ -603,7 +603,7 @@ void ingest(DB_ENV *dst_dbenv) {
        static size_t line_alloc = 1;
        static char *line;
        static size_t line_len = 0;
-       char ch;
+       int ch;
 
        fprintf(stderr, "\033[7mtable\033[0m \033[7mgood_rows\033[0m \033[7mbad_rows\033[0m\n");
        line = reallok(NULL, line_alloc);