Changeset: 1e731b1bc73d for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1e731b1bc73d
Modified Files:
        gdk/gdk_logger.c
        monetdb5/modules/kernel/logger.c
Branch: transaction-replication
Log Message:

Silence compiler
Variable use in an #if directive identifier
Avoid mixed declarations and code


diffs (148 lines):

diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -1373,12 +1373,14 @@ logger_new(int debug, char *fn, logger_s
        BBPrename(lg->freed->batCacheid, bak);
 
        if (fp != NULL) {
+#if SIZEOF_OID == 8
+               char cvfile[BUFSIZ];
+#endif
                if (check_version(lg, fp)) {
                        goto error;
                }
 
-/* Do not do conversion is running in readonly mode */
-#if SIZEOF_OID == 8 && !readonly
+#if SIZEOF_OID == 8
                /* When a file *_32-64-convert exists in the database,
                 * it was left there by the BBP initialization code
                 * when it did a conversion of 32-bit OIDs to 64 bits
@@ -1405,56 +1407,58 @@ logger_new(int debug, char *fn, logger_s
                 * what we expect, the conversion was apparently done
                 * already, and so we can delete the file. */
 
-               char cvfile[BUFSIZ];
-               snprintf(cvfile, sizeof(cvfile), "%sconvert-32-64", lg->dir);
-               snprintf(bak, sizeof(bak), "%s_32-64-convert", fn);
-               {
-                       FILE *fp1;
-                       long off;
-                       int curid;
+               /* Do not do conversion logger is readonly */
+               if (!readonly) {
+                       snprintf(cvfile, sizeof(cvfile), "%sconvert-32-64", 
lg->dir);
+                       snprintf(bak, sizeof(bak), "%s_32-64-convert", fn);
+                       {
+                               FILE *fp1;
+                               long off;
+                               int curid;
 
-                       /* read the current log id without disturbing
-                        * the file pointer */
-                       off = ftell(fp);
-                       if (fscanf(fp, "%d", &curid) != 1)
-                               curid = -1; /* shouldn't happen? */
-                       fseek(fp, off, SEEK_SET);
+                               /* read the current log id without disturbing
+                                * the file pointer */
+                               off = ftell(fp);
+                               if (fscanf(fp, "%d", &curid) != 1)
+                                       curid = -1; /* shouldn't happen? */
+                               fseek(fp, off, SEEK_SET);
 
-                       if ((fp1 = fopen(bak, "r")) != NULL) {
-                               /* file indicating that we need to do
-                                * a 32->64 bit OID conversion exists;
-                                * record the fact in case we get
-                                * interrupted, and set the flag so
-                                * that we actually do what's asked */
-                               fclose(fp1);
-                               /* first create a versioned file using
-                                * the current log id */
-                               fp1 = fopen(cvfile, "w");
-                               fprintf(fp1, "%d\n", curid);
-                               fclose(fp1);
-                               /* then remove the unversioned file
-                                * that gdk_bbp created (in this
-                                * order!) */
-                               unlink(bak);
-                               /* set the flag that we need to convert */
-                               lg->read32bitoid = 1;
-                       } else if ((fp1 = fopen(cvfile, "r")) != NULL) {
-                               /* the versioned conversion file
-                                * exists: check version */
-                               int newid;
+                               if ((fp1 = fopen(bak, "r")) != NULL) {
+                                       /* file indicating that we need to do
+                                        * a 32->64 bit OID conversion exists;
+                                        * record the fact in case we get
+                                        * interrupted, and set the flag so
+                                        * that we actually do what's asked */
+                                       fclose(fp1);
+                                       /* first create a versioned file using
+                                        * the current log id */
+                                       fp1 = fopen(cvfile, "w");
+                                       fprintf(fp1, "%d\n", curid);
+                                       fclose(fp1);
+                                       /* then remove the unversioned file
+                                        * that gdk_bbp created (in this
+                                        * order!) */
+                                       unlink(bak);
+                                       /* set the flag that we need to convert 
*/
+                                       lg->read32bitoid = 1;
+                               } else if ((fp1 = fopen(cvfile, "r")) != NULL) {
+                                       /* the versioned conversion file
+                                        * exists: check version */
+                                       int newid;
 
-                               if (fscanf(fp1, "%d", &newid) == 1 &&
-                                   newid == curid) {
-                                       /* versions match, we need to
-                                        * convert */
-                                       lg->read32bitoid = 1;
-                               }
-                               fclose(fp1);
-                               if (!lg->read32bitoid) {
-                                       /* no conversion, so we can
-                                        * remove the versioned
-                                        * file */
-                                       unlink(cvfile);
+                                       if (fscanf(fp1, "%d", &newid) == 1 &&
+                                               newid == curid) {
+                                               /* versions match, we need to
+                                                * convert */
+                                               lg->read32bitoid = 1;
+                                       }
+                                       fclose(fp1);
+                                       if (!lg->read32bitoid) {
+                                               /* no conversion, so we can
+                                                * remove the versioned
+                                                * file */
+                                               unlink(cvfile);
+                                       }
                                }
                        }
                }
diff --git a/monetdb5/modules/kernel/logger.c b/monetdb5/modules/kernel/logger.c
--- a/monetdb5/modules/kernel/logger.c
+++ b/monetdb5/modules/kernel/logger.c
@@ -90,7 +90,9 @@ logger_export str logger_create_wrap( lo
 str
 logger_create_wrap( logger *L, int *debug, str *fn, str *dirname, int *version)
 {
+       logger *l;
        logger_settings *log_settings = (struct logger_settings *) 
GDKmalloc(sizeof(struct logger_settings));
+
        log_settings->logdir = *dirname;
        /* Get and pass on the shared WAL directory location, if set */
        log_settings->shared_logdir = GDKgetenv("gdk_shared_logdir");
@@ -98,7 +100,7 @@ logger_create_wrap( logger *L, int *debu
         * -1 by default, meaning it should be ignored, since it is not set */
        log_settings->shared_drift_threshold = 
GDKgetenv_int("gdk_shared_drift_threshold", -1);
 
-       logger *l = logger_create(*debug, *fn, log_settings, *version, NULL, 
NULL, 0);
+       l = logger_create(*debug, *fn, log_settings, *version, NULL, NULL, 0);
 
        if (l) {
                *(logger**)L = l;
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to