]> git.ozlabs.org Git - ccan/commitdiff
clearing compilation warning
authorgdinesh@csa.iisc.ernet.in <>
Mon, 28 Jul 2008 05:41:37 +0000 (11:11 +0530)
committergdinesh@csa.iisc.ernet.in <>
Mon, 28 Jul 2008 05:41:37 +0000 (11:11 +0530)
tools/_infotojson/Makefile
tools/_infotojson/infotojson.c
tools/_infotojson/sqlite3_database.c
tools/_infotojson/utils.c
tools/_infotojson/utils.h

index a52fcab600f32e3a9d407706422f148fa1977a1d..8812e9b9cc7aaac35cf43c9860f2317514314760 100644 (file)
@@ -1 +1,2 @@
-tools/_infotojson/infotojson: tools/_infotojson/infotojson.o tools/_infotojson/sqlite3_database.o tools/_infotojson/utils.o
+tools/_infotojson/infotojson: tools/_infotojson/infotojson.o tools/_infotojson/sqlite3_database.o tools/_infotojson/utils.o ccan/string/string.o ccan/talloc/talloc.o
+       $(CC) $(LDFLAGS) -o $@ $^ -lsqlite3
index 611e0b392acef41b683f75d829a23ccd1b79a374..e169fe17c953051c863650310d6c657067a0dfc2 100644 (file)
@@ -112,7 +112,6 @@ int storejsontodb(struct json *jsonobj, char *db)
 {
        char *cmd, *query;
        sqlite3 *handle;
 {
        char *cmd, *query;
        sqlite3 *handle;
-       char *errstr;
        struct db_query *q;
        
        handle = db_open(db);
        struct db_query *q;
        
        handle = db_open(db);
index ed62aee07b94e154c1f75450fdeedccc9c69ea5d..6021eab6ab4b34d64f41a45518b5550f59e00629 100644 (file)
@@ -70,31 +70,6 @@ void db_command(void *h, const char *command)
                printf("Failed sqlite3 command '%s': %s", command, err);
 }
 
                printf("Failed sqlite3 command '%s': %s", command, err);
 }
 
-/* Starts transaction.  Doesn't need to nest. */
-/*void db_transaction_start(void *h)
-{
-       char *err;
-       if (sqlite3_exec(h, "BEGIN EXCLUSIVE TRANSACTION", NULL, NULL, &err)!=SQLITE_OK)
-               printf("Starting sqlite3 transaction: %s\n", err);
-}
-
-/* Finishes transaction, or rolls it back and caller needs to start again. */
-/*
-bool db_transaction_finish(void *h)
-{
-       switch (sqlite3_exec(h, "COMMIT TRANSACTION;", NULL, NULL, NULL)) {
-       case SQLITE_OK:
-               return true;
-       case SQLITE_BUSY:
-               if (sqlite3_exec(h, "ROLLBACK TRANSACTION;", NULL, NULL, NULL)
-                   != SQLITE_OK)
-                       printf("Ending sqlite3 busy rollback failed");
-               return false;
-       default:
-               printf("Strange sqlite3 error return from COMMIT");
-       }
-}*/
-
 /* Closes database (only called when everything OK). */
 void db_close(void *h)
 {
 /* Closes database (only called when everything OK). */
 void db_close(void *h)
 {
index 9f99972d490ae6eef1e23af904f07346bad9e4fe..4f2fc43abbc0bdd10a454d2e2c29631e207b570a 100644 (file)
@@ -1,11 +1,13 @@
-#include "utils.h"
+#define _GNU_SOURCE
 #include <stdio.h>
 #include <stdio.h>
+#include "utils.h"
 #include <string.h>
 #include <limits.h>
 #include <stdint.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <errno.h>
 #include <string.h>
 #include <limits.h>
 #include <stdint.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <errno.h>
+#include <err.h>
 #include <assert.h>
 #include "utils.h"
 
 #include <assert.h>
 #include "utils.h"
 
@@ -31,7 +33,7 @@ char *aprintf(const char *fmt, ...)
        return ret;
 }
 
        return ret;
 }
 
-int strreplace(char * str, char src, char dest)
+void strreplace(char * str, char src, char dest)
 {
        int i;
        for(i = 0; str[i]; i++)
 {
        int i;
        for(i = 0; str[i]; i++)
@@ -51,5 +53,5 @@ void *realloc_nofail(void *ptr, size_t size)
         ptr = realloc(ptr, size);
        if (ptr)
                return ptr;
         ptr = realloc(ptr, size);
        if (ptr)
                return ptr;
-       printf("realloc of %zu failed", size);
+       err(1, "realloc of %zu failed", size);
 }
 }
index 4a94e573f0f899d6de151bfbbe755d0efffa80a8..24f3375ef3699671733dfb20362110983bf2a17c 100644 (file)
@@ -14,4 +14,4 @@ void * palloc(int size);
 
 char *aprintf(const char *fmt, ...);
 
 
 char *aprintf(const char *fmt, ...);
 
-int strreplace(char * str, char src, char dest);
+void strreplace(char * str, char src, char dest);