Remove redundant MODULE constant.
authorTomas Mlcoch <tmlcoch@redhat.com>
Mon, 25 Feb 2013 11:08:17 +0000 (12:08 +0100)
committerTomas Mlcoch <tmlcoch@redhat.com>
Mon, 25 Feb 2013 11:08:17 +0000 (12:08 +0100)
src/compression_wrapper.c
src/load_metadata.c
src/locate_metadata.c
src/misc.c
src/parsehdr.c
src/parsepkg.c
src/repomd.c
src/sqlite.c

index 7bc0fe1..a436bd8 100644 (file)
@@ -30,9 +30,6 @@
 #include "logging.h"
 #include "compression_wrapper.h"
 
-#undef MODULE
-#define MODULE "compression_wrapper: "
-
 /*
 #define Z_CR_CW_NO_COMPRESSION         0
 #define Z_BEST_SPEED             1
@@ -100,7 +97,7 @@ cr_detect_compression(const char *filename)
     cr_CompressionType type = CR_CW_UNKNOWN_COMPRESSION;
 
     if (!g_file_test(filename, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR)) {
-        g_debug(MODULE"%s: File %s doesn't exists or it's not a regular file",
+        g_debug("%s: File %s doesn't exists or it's not a regular file",
                 __func__, filename);
         return type;
     }
@@ -131,14 +128,14 @@ cr_detect_compression(const char *filename)
     magic_t myt = magic_open(MAGIC_MIME);
     magic_load(myt, NULL);
     if (magic_check(myt, NULL) == -1) {
-        g_critical(MODULE"%s: magic_check() failed", __func__);
+        g_critical("%s: magic_check() failed", __func__);
         return type;
     }
 
     const char *mime_type = magic_file(myt, filename);
 
     if (mime_type) {
-        g_debug(MODULE"%s: Detected mime type: %s (%s)", __func__, mime_type,
+        g_debug("%s: Detected mime type: %s (%s)", __func__, mime_type,
                 filename);
 
         if (g_str_has_prefix(mime_type, "application/x-gzip") ||
@@ -177,7 +174,7 @@ cr_detect_compression(const char *filename)
             type = CR_CW_NO_COMPRESSION;
         }
     } else {
-        g_debug(MODULE"%s: Mime type not detected! (%s)", __func__, filename);
+        g_debug("%s: Mime type not detected! (%s)", __func__, filename);
     }
 
 
@@ -220,7 +217,7 @@ cr_open(const char *filename, cr_OpenMode mode, cr_CompressionType comtype)
     cr_CompressionType type;
 
     if (!filename || (mode != CR_CW_MODE_READ && mode != CR_CW_MODE_WRITE)) {
-        g_debug(MODULE"%s: Filename is NULL or bad mode value", __func__);
+        g_debug("%s: Filename is NULL or bad mode value", __func__);
         return NULL;
     }
 
@@ -229,13 +226,13 @@ cr_open(const char *filename, cr_OpenMode mode, cr_CompressionType comtype)
 
     if (mode == CR_CW_MODE_WRITE) {
         if (comtype == CR_CW_AUTO_DETECT_COMPRESSION) {
-            g_debug(MODULE"%s: CR_CW_AUTO_DETECT_COMPRESSION cannot be used if "
+            g_debug("%s: CR_CW_AUTO_DETECT_COMPRESSION cannot be used if "
                     "mode is CR_CW_MODE_WRITE", __func__);
             return NULL;
         }
 
         if (comtype == CR_CW_UNKNOWN_COMPRESSION) {
-            g_debug(MODULE"%s: CR_CW_UNKNOWN_COMPRESSION cannot be used if mode"
+            g_debug("%s: CR_CW_UNKNOWN_COMPRESSION cannot be used if mode"
             " is CR_CW_MODE_WRITE", __func__);
             return NULL;
         }
@@ -249,7 +246,7 @@ cr_open(const char *filename, cr_OpenMode mode, cr_CompressionType comtype)
     }
 
     if (type == CR_CW_UNKNOWN_COMPRESSION) {
-        g_debug(MODULE"%s: Cannot detect compression type", __func__);
+        g_debug("%s: Cannot detect compression type", __func__);
         return NULL;
     }
 
@@ -282,7 +279,7 @@ cr_open(const char *filename, cr_OpenMode mode, cr_CompressionType comtype)
             }
 
             if (gzbuffer((gzFile) file->FILE, GZ_BUFFER_SIZE) == -1) {
-                g_debug(MODULE"%s: gzbuffer() call failed", __func__);
+                g_debug("%s: gzbuffer() call failed", __func__);
             }
             break;
 
@@ -335,20 +332,20 @@ cr_open(const char *filename, cr_OpenMode mode, cr_CompressionType comtype)
             if (ret != LZMA_OK) {
                 switch (ret) {
                     case LZMA_MEM_ERROR:
-                        g_debug(MODULE"%s: XZ: Cannot allocate memory",
+                        g_debug("%s: XZ: Cannot allocate memory",
                                 __func__);
                         break;
                     case LZMA_OPTIONS_ERROR:
-                        g_debug(MODULE"%s: XZ: Unsupported flags (options)",
+                        g_debug("%s: XZ: Unsupported flags (options)",
                                 __func__);
                         break;
                     case LZMA_PROG_ERROR:
-                        g_debug(MODULE"%s: XZ: One or more of the parameters "
+                        g_debug("%s: XZ: One or more of the parameters "
                                 "have values that will never be valid.",
                                 __func__);
                         break;
                     default:
-                        g_debug(MODULE"%s: XZ: Unknown error", __func__);
+                        g_debug("%s: XZ: Unknown error", __func__);
                 }
                 g_free((void *) xz_file);
                 break;
@@ -522,10 +519,10 @@ cr_read(CR_FILE *cr_file, void *buffer, unsigned int len)
                 // Fill input buffer
                 if (stream->avail_in == 0) {
                     if ((lret = fread(xz_file->buffer, 1, XZ_BUFFER_SIZE, xz_file->file)) < 0) {
-                        g_debug(MODULE"%s: XZ: Error while fread", __func__);
+                        g_debug("%s: XZ: Error while fread", __func__);
                         return CR_CW_ERR;   // Error while reading input file
                     } else if (lret == 0) {
-                        g_debug(MODULE"%s: EOF", __func__);
+                        g_debug("%s: EOF", __func__);
                         break;   // EOF
                     }
                     stream->next_in = xz_file->buffer;
@@ -535,7 +532,7 @@ cr_read(CR_FILE *cr_file, void *buffer, unsigned int len)
                 // Decode
                 lret = lzma_code(stream, LZMA_RUN);
                 if (lret != LZMA_OK && lret != LZMA_STREAM_END) {
-                    g_debug(MODULE"%s: XZ: Error while decoding (%d)", __func__, lret);
+                    g_debug("%s: XZ: Error while decoding (%d)", __func__, lret);
                     return CR_CW_ERR;  // Error while decoding
                 }
                 if (lret == LZMA_STREAM_END) {
@@ -705,7 +702,7 @@ cr_printf(CR_FILE *cr_file, const char *format, ...)
     va_end(vl);
 
     if (ret < 0) {
-        g_debug(MODULE"%s: vasprintf() call failed", __func__);
+        g_debug("%s: vasprintf() call failed", __func__);
         return CR_CW_ERR;
     }
 
index bec7c36..4742479 100644 (file)
@@ -31,9 +31,6 @@
 #include "compression_wrapper.h"
 #include "locate_metadata.h"
 
-#undef MODULE
-#define MODULE "load_metadata: "
-
 #define STRINGCHUNK_SIZE        16384
 #define CHUNK_SIZE              8192
 #define PKGS_REALLOC_STEP       2000
@@ -219,7 +216,7 @@ pri_start_handler(void *data, const char *el, const char **attr)
     } else if (!strcmp(el, "rpm:entry")) {
         if (!pkg) {
             ppd->error = TRUE;
-            g_critical(MODULE"%s: Have <rpm:entry> but pkg object doesn't exist!",
+            g_critical("%s: Have <rpm:entry> but pkg object doesn't exist!",
                        __func__);
             return;
         }
@@ -245,7 +242,7 @@ pri_start_handler(void *data, const char *el, const char **attr)
                     dependency->pre = TRUE;
                 }
             } else {
-                g_warning(MODULE"%s: Unknown attribute \"%s\"", __func__, attr[i]);
+                g_warning("%s: Unknown attribute \"%s\"", __func__, attr[i]);
             }
         }
 
@@ -264,7 +261,7 @@ pri_start_handler(void *data, const char *el, const char **attr)
                 break;
             default:
                 g_free(dependency);
-                g_warning(MODULE"%s: Bad context (%d) for rpm:entry", __func__,
+                g_warning("%s: Bad context (%d) for rpm:entry", __func__,
                           ppd->context);
                 break;
         }
@@ -274,12 +271,12 @@ pri_start_handler(void *data, const char *el, const char **attr)
         // Check sanity
         if (ppd->context != METADATA) {
             ppd->error = TRUE;
-            g_critical(MODULE"%s: Package element: Bad XML context!", __func__);
+            g_critical("%s: Package element: Bad XML context!", __func__);
             return;
         }
         if (ppd->pkg) {
             ppd->error = TRUE;
-            g_critical(MODULE"%s: Package element: Pkg pointer is not NULL",
+            g_critical("%s: Package element: Pkg pointer is not NULL",
                        __func__);
             return;
         }
@@ -303,7 +300,7 @@ pri_start_handler(void *data, const char *el, const char **attr)
     } else if (!strcmp(el, "version")) {
         if (!pkg) {
             ppd->error = TRUE;
-            g_critical(MODULE"%s: Have <version> but pkg object doesn't exist!",
+            g_critical("%s: Have <version> but pkg object doesn't exist!",
                        __func__);
             return;
         }
@@ -316,7 +313,7 @@ pri_start_handler(void *data, const char *el, const char **attr)
             } else if (!strcmp(attr[i], "rel")) {
                 pkg->release = g_string_chunk_insert(pkg->chunk, attr[i+1]);
             } else {
-                g_warning(MODULE"%s: Unknown attribute \"%s\"", __func__, attr[i]);
+                g_warning("%s: Unknown attribute \"%s\"", __func__, attr[i]);
             }
         }
 
@@ -326,7 +323,7 @@ pri_start_handler(void *data, const char *el, const char **attr)
 
         if (!pkg) {
             ppd->error = TRUE;
-            g_critical(MODULE"%s: Have <checksum> but pkg object doesn't exist!",
+            g_critical("%s: Have <checksum> but pkg object doesn't exist!",
                        __func__);
             return;
         }
@@ -357,7 +354,7 @@ pri_start_handler(void *data, const char *el, const char **attr)
     } else if (!strcmp(el, "time")) {
         if (!pkg) {
             ppd->error = TRUE;
-            g_critical(MODULE"%s: Have <time> but pkg object doesn't exist!", __func__);
+            g_critical("%s: Have <time> but pkg object doesn't exist!", __func__);
             return;
         }
 
@@ -367,7 +364,7 @@ pri_start_handler(void *data, const char *el, const char **attr)
             } else if (!strcmp(attr[i], "build")) {
                 pkg->time_build = g_ascii_strtoll(attr[i+1], NULL, 10);
             } else {
-                g_warning(MODULE"%s: Unknown attribute \"%s\"", __func__, attr[i]);
+                g_warning("%s: Unknown attribute \"%s\"", __func__, attr[i]);
             }
         }
 
@@ -375,7 +372,7 @@ pri_start_handler(void *data, const char *el, const char **attr)
     } else if (!strcmp(el, "size")) {
         if (!pkg) {
             ppd->error = TRUE;
-            g_critical(MODULE"%s: Have <size> but pkg object doesn't exist!",
+            g_critical("%s: Have <size> but pkg object doesn't exist!",
                        __func__);
             return;
         }
@@ -388,7 +385,7 @@ pri_start_handler(void *data, const char *el, const char **attr)
             } else if (!strcmp(attr[i], "archive")) {
                 pkg->size_archive = g_ascii_strtoll(attr[i+1], NULL, 10);
             } else {
-                g_warning(MODULE"%s: Unknown attribute \"%s\"", __func__, attr[i]);
+                g_warning("%s: Unknown attribute \"%s\"", __func__, attr[i]);
             }
         }
 
@@ -396,7 +393,7 @@ pri_start_handler(void *data, const char *el, const char **attr)
     } else if (!strcmp(el, "location")) {
         if (!pkg) {
             ppd->error = TRUE;
-            g_critical(MODULE"%s: Have <location> but pkg object doesn't exist!",
+            g_critical("%s: Have <location> but pkg object doesn't exist!",
                        __func__);
             return;
         }
@@ -407,7 +404,7 @@ pri_start_handler(void *data, const char *el, const char **attr)
             } else if (!strcmp(attr[i], "xml:base")) {
                 pkg->location_base = g_string_chunk_insert(pkg->chunk, attr[i+1]);
             } else {
-                g_warning(MODULE"%s: Unknown attribute \"%s\"", __func__, attr[i]);
+                g_warning("%s: Unknown attribute \"%s\"", __func__, attr[i]);
             }
         }
 
@@ -439,7 +436,7 @@ pri_start_handler(void *data, const char *el, const char **attr)
     } else if (!strcmp(el, "rpm:header-range")) {
         if (!pkg) {
             ppd->error = TRUE;
-            g_critical(MODULE"%s: Have <rpm:header-range> but pkg object doesn't exist!",
+            g_critical("%s: Have <rpm:header-range> but pkg object doesn't exist!",
                        __func__);
             return;
         }
@@ -450,7 +447,7 @@ pri_start_handler(void *data, const char *el, const char **attr)
             } else if (!strcmp(attr[i], "end")) {
                 pkg->rpm_header_end = g_ascii_strtoll(attr[i+1], NULL, 10);
             } else {
-                g_warning(MODULE"%s: Unknown attribute \"%s\"", __func__, attr[i]);
+                g_warning("%s: Unknown attribute \"%s\"", __func__, attr[i]);
             }
         }
 
@@ -474,7 +471,7 @@ pri_start_handler(void *data, const char *el, const char **attr)
     } else if (!strcmp(el, "metadata")) {
         if (ppd->context != ROOT) {
             ppd->error = TRUE;
-            g_critical(MODULE"%s: Bad context (%d) for %s element", __func__,
+            g_critical("%s: Bad context (%d) for %s element", __func__,
                        ppd->context, el);
             return;
         }
@@ -483,7 +480,7 @@ pri_start_handler(void *data, const char *el, const char **attr)
     // unknown element
     } else {
         ppd->error = TRUE;
-        g_warning(MODULE"%s: Unknown element: %s", __func__, el);
+        g_warning("%s: Unknown element: %s", __func__, el);
     }
 }
 
@@ -521,7 +518,7 @@ pri_char_handler(void *data, const char *txt, int txtlen)
             break;
         default:
             ppd->error = TRUE;
-            g_warning(MODULE"%s: Unknown xml element (%d) in primary.xml",
+            g_warning("%s: Unknown xml element (%d) in primary.xml",
                       __func__, ppd->last_elem);
             break;
     }
@@ -620,7 +617,7 @@ pri_end_handler(void *data, const char *el)
                 if (key && key[0] != '\0') {
                     g_hash_table_replace(ppd->hashtable, key, ppd->pkg);
                 } else {
-                    g_warning(MODULE"%s: Empty hashtable key!", __func__);
+                    g_warning("%s: Empty hashtable key!", __func__);
                 }
 
                 // Reverse lists
@@ -670,13 +667,13 @@ fil_start_handler(void *data, const char *el, const char **attr)
 
         if (ppd->context != PACKAGE) {
             ppd->error = TRUE;
-            g_critical(MODULE"%s: Bad context of <file> element!", __func__);
+            g_critical("%s: Bad context of <file> element!", __func__);
             return;
         }
 
         if (!pkg) {
             ppd->error = TRUE;
-            g_critical(MODULE"%s: Have <file> but pkg object doesn't exist!", __func__);
+            g_critical("%s: Have <file> but pkg object doesn't exist!", __func__);
             return;
         }
 
@@ -688,7 +685,7 @@ fil_start_handler(void *data, const char *el, const char **attr)
                     ppd->last_elem = FILE_GHOST_ELEM;
                 }
             } else {
-                g_warning(MODULE"%s: Unknown attribute \"%s\"", __func__, attr[i]);
+                g_warning("%s: Unknown attribute \"%s\"", __func__, attr[i]);
             }
         }
 
@@ -697,12 +694,12 @@ fil_start_handler(void *data, const char *el, const char **attr)
         // Check sanity
         if (ppd->context != FILELISTS) {
             ppd->error = TRUE;
-            g_critical(MODULE"%s: Package element: Bad XML context!", __func__);
+            g_critical("%s: Package element: Bad XML context!", __func__);
             return;
         }
         if (ppd->pkg) {
             ppd->error = TRUE;
-            g_critical(MODULE"%s: Package element: Pkg pointer is not NULL", __func__);
+            g_critical("%s: Package element: Pkg pointer is not NULL", __func__);
             return;
         }
 
@@ -724,12 +721,12 @@ fil_start_handler(void *data, const char *el, const char **attr)
 
             //if (!ppd->pkg) {
             //    ppd->error = TRUE;
-            //    g_critical(MODULE"%s: Unknown package (package ID: %s)",
+            //    g_critical("%s: Unknown package (package ID: %s)",
             //               __func__, key);
             //}
         } else {
             ppd->error = TRUE;
-            g_critical(MODULE"%s: Package withou pkgid attribute found!", __func__);
+            g_critical("%s: Package withou pkgid attribute found!", __func__);
         }
 
         if (ppd->pkg && ppd->chunk)
@@ -743,7 +740,7 @@ fil_start_handler(void *data, const char *el, const char **attr)
     } else if (!strcmp(el, "filelists")) {
         if (ppd->context != ROOT) {
             ppd->error = TRUE;
-            g_critical(MODULE"%s: Bad context (%d) for %s element", __func__,
+            g_critical("%s: Bad context (%d) for %s element", __func__,
                        ppd->context, el);
             return;
         }
@@ -752,7 +749,7 @@ fil_start_handler(void *data, const char *el, const char **attr)
     // Unknown element
     } else {
         ppd->error = TRUE;
-        g_warning(MODULE"%s: Unknown element: %s", __func__, el);
+        g_warning("%s: Unknown element: %s", __func__, el);
     }
 }
 
@@ -776,7 +773,7 @@ fil_char_handler(void *data, const char *txt, int txtlen)
             break;
         default:
             ppd->error = TRUE;
-            g_warning(MODULE"%s: Unknown xml element (%d) in filelists.xml",
+            g_warning("%s: Unknown xml element (%d) in filelists.xml",
                       __func__, ppd->last_elem);
             break;
     }
@@ -804,7 +801,7 @@ fil_end_handler(void *data, const char *el)
             case FILE_DIR_ELEM:
             case FILE_GHOST_ELEM:
                 if (!txt || txtlen == 0) {
-                    g_warning(MODULE"%s: File with empty filename found!",
+                    g_warning("%s: File with empty filename found!",
                               __func__);
                     break;
                 }
@@ -828,7 +825,7 @@ fil_end_handler(void *data, const char *el)
 
             default:
                 ppd->error = TRUE;
-                g_warning(MODULE"%s: Bad last xml element state (%d) in filelists.xml",
+                g_warning("%s: Bad last xml element state (%d) in filelists.xml",
                           __func__, ppd->last_elem);
                 break;
         }
@@ -878,13 +875,13 @@ oth_start_handler(void *data, const char *el, const char **attr)
 
         if (ppd->context != PACKAGE) {
             ppd->error = TRUE;
-            g_critical(MODULE"%s: Bad context of <changelog> element!", __func__);
+            g_critical("%s: Bad context of <changelog> element!", __func__);
             return;
         }
 
         if (!pkg) {
             ppd->error = TRUE;
-            g_critical(MODULE"%s: Have <changelog> but pkg object doesn't exist!",
+            g_critical("%s: Have <changelog> but pkg object doesn't exist!",
                        __func__);
             return;
         }
@@ -898,7 +895,7 @@ oth_start_handler(void *data, const char *el, const char **attr)
             } else if (!strcmp(attr[i], "date")) {
                 changelog_entry->date = g_ascii_strtoll(attr[i+1], NULL, 10);;
             } else {
-                g_warning(MODULE"%s: Unknown attribute \"%s\"", __func__, attr[i]);
+                g_warning("%s: Unknown attribute \"%s\"", __func__, attr[i]);
             }
         }
 
@@ -909,13 +906,13 @@ oth_start_handler(void *data, const char *el, const char **attr)
         // Check sanity
         if (ppd->context != OTHERDATA) {
             ppd->error = TRUE;
-            g_critical(MODULE"%s: Package element: Bad XML context (%d)!",
+            g_critical("%s: Package element: Bad XML context (%d)!",
                        __func__, ppd->context);
             return;
         }
         if (ppd->pkg) {
             ppd->error = TRUE;
-            g_critical(MODULE"%s: Package element: Pkg pointer is not NULL",
+            g_critical("%s: Package element: Pkg pointer is not NULL",
                        __func__);
             return;
         }
@@ -939,12 +936,12 @@ oth_start_handler(void *data, const char *el, const char **attr)
 
             //if (!ppd->pkg) {
             //    ppd->error = TRUE;
-            //    g_critical(MODULE"%s: Unknown package (package ID: %s)",
+            //    g_critical("%s: Unknown package (package ID: %s)",
             //               __func__, key);
             //}
         } else {
             ppd->error = TRUE;
-            g_critical(MODULE"%s: Package withou pkgid attribute found!",
+            g_critical("%s: Package withou pkgid attribute found!",
                        __func__);
         }
 
@@ -959,7 +956,7 @@ oth_start_handler(void *data, const char *el, const char **attr)
     } else if (!strcmp(el, "otherdata")) {
         if (ppd->context != ROOT) {
             ppd->error = TRUE;
-            g_critical(MODULE"%s: Bad context (%d) for %s element", __func__,
+            g_critical("%s: Bad context (%d) for %s element", __func__,
                        ppd->context, el);
             return;
         }
@@ -968,7 +965,7 @@ oth_start_handler(void *data, const char *el, const char **attr)
     // Unknown element
     } else {
         ppd->error = TRUE;
-        g_warning(MODULE"%s: Unknown element: %s", __func__, el);
+        g_warning("%s: Unknown element: %s", __func__, el);
     }
 }
 
@@ -990,7 +987,7 @@ oth_char_handler(void *data, const char *txt, int txtlen)
             break;
         default:
             ppd->error = TRUE;
-            g_warning(MODULE"%s: Unknown xml element (%d) in other.xml",
+            g_warning("%s: Unknown xml element (%d) in other.xml",
                       __func__, ppd->last_elem);
             break;
     }
@@ -1019,7 +1016,7 @@ oth_end_handler(void *data, const char *el)
 
             default:
                 ppd->error = TRUE;
-                g_warning(MODULE"%s: Bad last xml element state (%d) in other.xml",
+                g_warning("%s: Bad last xml element state (%d) in other.xml",
                           __func__, ppd->last_elem);
                 break;
         }
@@ -1065,7 +1062,7 @@ load_xml_files(GHashTable *hashtable, const char *primary_xml_path,
 
     compression_type = cr_detect_compression(primary_xml_path);
     if (compression_type == CR_CW_UNKNOWN_COMPRESSION) {
-        g_debug(MODULE"%s: Unknown compression", __func__);
+        g_debug("%s: Unknown compression", __func__);
         return CR_LOAD_METADATA_ERR;
     }
 
@@ -1073,17 +1070,17 @@ load_xml_files(GHashTable *hashtable, const char *primary_xml_path,
     // Open files
 
     if (!(pri_xml_cwfile = cr_open(primary_xml_path, CR_CW_MODE_READ, compression_type))) {
-        g_debug(MODULE"%s: Cannot open file: %s", __func__, primary_xml_path);
+        g_debug("%s: Cannot open file: %s", __func__, primary_xml_path);
         return CR_LOAD_METADATA_ERR;
     }
 
     if (!(fil_xml_cwfile = cr_open(filelists_xml_path, CR_CW_MODE_READ, compression_type))) {
-        g_debug(MODULE"%s: Cannot open file: %s", __func__, filelists_xml_path);
+        g_debug("%s: Cannot open file: %s", __func__, filelists_xml_path);
         return CR_LOAD_METADATA_ERR;
     }
 
     if (!(oth_xml_cwfile = cr_open(other_xml_path, CR_CW_MODE_READ, compression_type))) {
-        g_debug(MODULE"%s: Cannot open file: %s", __func__, other_xml_path);
+        g_debug("%s: Cannot open file: %s", __func__, other_xml_path);
         return CR_LOAD_METADATA_ERR;
     }
 
@@ -1124,18 +1121,18 @@ load_xml_files(GHashTable *hashtable, const char *primary_xml_path,
 
         pri_buff = XML_GetBuffer(pri_p, CHUNK_SIZE);
         if (!pri_buff) {
-            g_critical(MODULE"%s: Ran out of memory for parse", __func__);
+            g_critical("%s: Ran out of memory for parse", __func__);
             return CR_LOAD_METADATA_ERR;
         }
 
         pri_len = cr_read(pri_xml_cwfile, (void *) pri_buff, CHUNK_SIZE);
         if (pri_len < 0) {
-            g_critical(MODULE"%s: Read error", __func__);
+            g_critical("%s: Read error", __func__);
             return CR_LOAD_METADATA_ERR;
         }
 
         if (! XML_ParseBuffer(pri_p, pri_len, pri_len == 0)) {
-            g_critical(MODULE"%s: Parse error at line: %d (%s)", __func__,
+            g_critical("%s: Parse error at line: %d (%s)", __func__,
                                 (int) XML_GetCurrentLineNumber(pri_p),
                                 (char *) XML_ErrorString(XML_GetErrorCode(pri_p)));
             return CR_LOAD_METADATA_ERR;
@@ -1160,18 +1157,18 @@ load_xml_files(GHashTable *hashtable, const char *primary_xml_path,
 
         fil_buff = XML_GetBuffer(fil_p, CHUNK_SIZE);
         if (!fil_buff) {
-            g_critical(MODULE"%s: Ran out of memory for parse", __func__);
+            g_critical("%s: Ran out of memory for parse", __func__);
             return CR_LOAD_METADATA_ERR;
         }
 
         fil_len = cr_read(fil_xml_cwfile, (void *) fil_buff, CHUNK_SIZE);
         if (fil_len < 0) {
-            g_critical(MODULE"%s: Read error", __func__);
+            g_critical("%s: Read error", __func__);
             return CR_LOAD_METADATA_ERR;
         }
 
         if (! XML_ParseBuffer(fil_p, fil_len, fil_len == 0)) {
-            g_critical(MODULE"%s: Parse error at line: %d (%s)", __func__,
+            g_critical("%s: Parse error at line: %d (%s)", __func__,
                                 (int) XML_GetCurrentLineNumber(fil_p),
                                 (char *) XML_ErrorString(XML_GetErrorCode(fil_p)));
             return CR_LOAD_METADATA_ERR;
@@ -1196,18 +1193,18 @@ load_xml_files(GHashTable *hashtable, const char *primary_xml_path,
 
         oth_buff = XML_GetBuffer(oth_p, CHUNK_SIZE);
         if (!oth_buff) {
-            g_critical(MODULE"%s: Ran out of memory for parse", __func__);
+            g_critical("%s: Ran out of memory for parse", __func__);
             return CR_LOAD_METADATA_ERR;
         }
 
         oth_len = cr_read(oth_xml_cwfile, (void *) oth_buff, CHUNK_SIZE);
         if (oth_len < 0) {
-            g_critical(MODULE"%s: Read error", __func__);
+            g_critical("%s: Read error", __func__);
             return CR_LOAD_METADATA_ERR;
         }
 
         if (! XML_ParseBuffer(oth_p, oth_len, oth_len == 0)) {
-            g_critical(MODULE"%s: Parse error at line: %d (%s)", __func__,
+            g_critical("%s: Parse error at line: %d (%s)", __func__,
                                 (int) XML_GetCurrentLineNumber(oth_p),
                                 (char *) XML_ErrorString(XML_GetErrorCode(oth_p)));
             return CR_LOAD_METADATA_ERR;
@@ -1264,13 +1261,13 @@ cr_load_xml_metadata(cr_Metadata md, struct cr_MetadataLocation *ml)
                             md->chunk, md->pkglist_ht);
 
     if (result == CR_LOAD_METADATA_ERR) {
-        g_critical(MODULE"%s: Error encountered while parsing", __func__);
+        g_critical("%s: Error encountered while parsing", __func__);
         cr_destroy_metadata_hashtable(intern_hashtable);
         cr_free_metadata_location(ml);
         return result;
     }
 
-    g_debug(MODULE"%s: Parsed items: %d", __func__,
+    g_debug("%s: Parsed items: %d", __func__,
             g_hash_table_size(intern_hashtable));
 
     // Fill user hashtable and use user selected key
@@ -1294,14 +1291,14 @@ cr_load_xml_metadata(cr_Metadata md, struct cr_MetadataLocation *ml)
                 new_key = pkg->name;
                 break;
             default:
-                g_critical(MODULE"%s: Unknown hash table key selected",
+                g_critical("%s: Unknown hash table key selected",
                            __func__);
                 new_key = pkg->pkgId;
                 break;
         }
 
         if (g_hash_table_lookup(md->ht, new_key)) {
-            g_debug(MODULE"%s: Key \"%s\" already exists in hashtable",
+            g_debug("%s: Key \"%s\" already exists in hashtable",
                     __func__, (char *) new_key);
             g_hash_table_iter_remove(&iter);
         } else {
index 32b620f..18792e9 100644 (file)
@@ -27,9 +27,6 @@
 #include "misc.h"
 #include "locate_metadata.h"
 
-#undef MODULE
-#define MODULE "locate_metadata: "
-
 #define TMPDIR_PATTERN  "/tmp/createrepo_c_tmp_repo_XXXXXX"
 
 #define FORMAT_XML      1
@@ -45,7 +42,7 @@ cr_free_metadata_location(struct cr_MetadataLocation *ml)
     }
 
     if (ml->tmp_dir) {
-        g_debug(MODULE"%s: Removing %s", __func__,  ml->tmp_dir);
+        g_debug("%s: Removing %s", __func__,  ml->tmp_dir);
         cr_remove_dir(ml->tmp_dir);
     }
 
@@ -78,14 +75,14 @@ parse_repomd(const char *repomd_path, const char *repopath, int ignore_sqlite)
     // Parsing
     reader = xmlReaderForFile(repomd_path, NULL, XML_PARSE_NOBLANKS);
     if (!reader) {
-        g_warning(MODULE"%s: Error while xmlReaderForFile()", __func__);
+        g_warning("%s: Error while xmlReaderForFile()", __func__);
         return NULL;
     }
 
     ret = xmlTextReaderRead(reader);
     name = xmlTextReaderName(reader);
     if (g_strcmp0((char *) name, "repomd")) {
-        g_warning(MODULE"%s: Bad xml - missing repomd element? (%s)",
+        g_warning("%s: Bad xml - missing repomd element? (%s)",
                   __func__, name);
         xmlFree(name);
         xmlFreeTextReader(reader);
@@ -96,7 +93,7 @@ parse_repomd(const char *repomd_path, const char *repopath, int ignore_sqlite)
     ret = xmlTextReaderRead(reader);
     name = xmlTextReaderName(reader);
     if (g_strcmp0((char *) name, "revision")) {
-        g_warning(MODULE"%s: Bad xml - missing revision element? (%s)",
+        g_warning("%s: Bad xml - missing revision element? (%s)",
                   __func__, name);
         xmlFree(name);
         xmlFreeTextReader(reader);
@@ -120,7 +117,7 @@ parse_repomd(const char *repomd_path, const char *repopath, int ignore_sqlite)
 
     if (!ret) {
         // No elements left -> Bad xml
-        g_warning(MODULE"%s: Bad xml - missing data elements?", __func__);
+        g_warning("%s: Bad xml - missing data elements?", __func__);
         xmlFreeTextReader(reader);
         return NULL;
     }
@@ -230,7 +227,7 @@ get_local_metadata(const char *in_repopath, int ignore_sqlite)
     }
 
     if (!g_file_test(in_repopath, G_FILE_TEST_EXISTS|G_FILE_TEST_IS_DIR)) {
-        g_warning(MODULE"%s: %s is not a directory", __func__, in_repopath);
+        g_warning("%s: %s is not a directory", __func__, in_repopath);
         return ret;
     }
 
@@ -246,7 +243,7 @@ get_local_metadata(const char *in_repopath, int ignore_sqlite)
     repomd = g_strconcat(repopath, "repodata/repomd.xml", NULL);
 
     if (!g_file_test(repomd, G_FILE_TEST_EXISTS)) {
-        g_debug(MODULE"%s: %s doesn't exists", __func__, repomd);
+        g_debug("%s: %s doesn't exists", __func__, repomd);
         g_free(repomd);
         g_free(repopath);
         return ret;
@@ -284,7 +281,7 @@ get_remote_metadata(const char *repopath, int ignore_sqlite)
     // Create temporary repo in /tmp
 
     if(!mkdtemp(tmp_dir)) {
-        g_critical(MODULE"%s: Cannot create a temporary directory: %s",
+        g_critical("%s: Cannot create a temporary directory: %s",
                    __func__, strerror(errno));
         return ret;
     }
@@ -292,7 +289,7 @@ get_remote_metadata(const char *repopath, int ignore_sqlite)
     tmp_repodata = g_strconcat(tmp_dir, "/repodata/", NULL);
 
     if (g_mkdir (tmp_repodata, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH)) {
-        g_critical(MODULE"%s: Cannot create a temporary directory", __func__);
+        g_critical("%s: Cannot create a temporary directory", __func__);
         return ret;
     }
 
@@ -302,11 +299,11 @@ get_remote_metadata(const char *repopath, int ignore_sqlite)
     tmp_repomd = g_strconcat(tmp_repodata, "repomd.xml", NULL);
     f_repomd = fopen(tmp_repomd, "w");
     if (!f_repomd) {
-        g_critical(MODULE"%s: Cannot open %s", __func__, tmp_repomd);
+        g_critical("%s: Cannot open %s", __func__, tmp_repomd);
         goto get_remote_metadata_cleanup;
     }
 
-    g_debug(MODULE"%s: Using tmp dir: %s", __func__, tmp_dir);
+    g_debug("%s: Using tmp dir: %s", __func__, tmp_dir);
 
 
     // Download repo files
@@ -316,25 +313,25 @@ get_remote_metadata(const char *repopath, int ignore_sqlite)
 
     // Set error buffer
     if (curl_easy_setopt(handle, CURLOPT_ERRORBUFFER, errorbuf) != CURLE_OK) {
-        g_critical(MODULE"%s: curl_easy_setopt(CURLOPT_ERRORBUFFER) error", __func__);
+        g_critical("%s: curl_easy_setopt(CURLOPT_ERRORBUFFER) error", __func__);
         goto get_remote_metadata_cleanup;
     }
 
     // Set URL
     if (curl_easy_setopt(handle, CURLOPT_URL, url) != CURLE_OK) {
-        g_critical(MODULE"%s: curl_easy_setopt(CURLOPT_URL) error", __func__);
+        g_critical("%s: curl_easy_setopt(CURLOPT_URL) error", __func__);
         goto get_remote_metadata_cleanup;
     }
 
     // Set output file descriptor
     if (curl_easy_setopt(handle, CURLOPT_WRITEDATA, f_repomd) != CURLE_OK) {
-        g_critical(MODULE"%s: curl_easy_setopt(CURLOPT_WRITEDATA) error", __func__);
+        g_critical("%s: curl_easy_setopt(CURLOPT_WRITEDATA) error", __func__);
         goto get_remote_metadata_cleanup;
     }
 
     // Fail on HTTP error (return code >= 400)
     if (curl_easy_setopt(handle, CURLOPT_FAILONERROR, 1) != CURLE_OK) {
-        g_critical(MODULE"%s: curl_easy_setopt(CURLOPT_FAILONERROR) error", __func__);
+        g_critical("%s: curl_easy_setopt(CURLOPT_FAILONERROR) error", __func__);
         goto get_remote_metadata_cleanup;
     }
 
@@ -343,7 +340,7 @@ get_remote_metadata(const char *repopath, int ignore_sqlite)
 
     rcode = curl_easy_perform(handle);
     if (rcode != 0) {
-        g_critical(MODULE"%s: curl_easy_perform() error: %s", __func__, errorbuf);
+        g_critical("%s: curl_easy_perform() error: %s", __func__, errorbuf);
         goto get_remote_metadata_cleanup;
     }
 
@@ -355,7 +352,7 @@ get_remote_metadata(const char *repopath, int ignore_sqlite)
 
     r_location = parse_repomd(tmp_repomd, repopath, ignore_sqlite);
     if (!r_location) {
-        g_critical(MODULE"%s: repomd.xml parser failed on %s", __func__, tmp_repomd);
+        g_critical("%s: repomd.xml parser failed on %s", __func__, tmp_repomd);
         goto get_remote_metadata_cleanup;
     }
 
@@ -383,12 +380,12 @@ get_remote_metadata(const char *repopath, int ignore_sqlite)
         cr_download(handle, r_location->updateinfo_href, tmp_repodata, &error);
 
     if (error) {
-        g_critical(MODULE"%s: Error while downloadig files: %s", __func__, error);
+        g_critical("%s: Error while downloadig files: %s", __func__, error);
         g_free(error);
         goto get_remote_metadata_cleanup;
     }
 
-    g_debug(MODULE"%s: Remote metadata was successfully downloaded", __func__);
+    g_debug("%s: Remote metadata was successfully downloaded", __func__);
 
 
     // Parse downloaded data
@@ -498,14 +495,14 @@ cr_remove_metadata(const char *repopath)
     struct cr_MetadataLocation *ml;
 
     if (!repopath || !g_file_test(repopath, G_FILE_TEST_EXISTS|G_FILE_TEST_IS_DIR)) {
-        g_debug(MODULE"%s: remove_old_metadata: Cannot remove %s", __func__, repopath);
+        g_debug("%s: remove_old_metadata: Cannot remove %s", __func__, repopath);
         return -1;
     }
 
     full_repopath = g_strconcat(repopath, "/repodata/", NULL);
     repodir = g_dir_open(full_repopath, 0, NULL);
     if (!repodir) {
-        g_debug(MODULE"%s: Path %s doesn't exists", __func__, repopath);
+        g_debug("%s: Path %s doesn't exists", __func__, repopath);
         g_free(full_repopath);
         return -1;
     }
@@ -521,9 +518,9 @@ cr_remove_metadata(const char *repopath)
         for (element=list; element; element=element->next) {
             gchar *path = (char *) element->data;
 
-            g_debug(MODULE"%s: Removing: %s (path obtained from repomd.xml)", __func__, path);
+            g_debug("%s: Removing: %s (path obtained from repomd.xml)", __func__, path);
             if (g_remove(path) == -1) {
-                // g_warning(MODULE"%s: remove_old_metadata: Cannot remove %s", __func__, path);
+                // g_warning("%s: remove_old_metadata: Cannot remove %s", __func__, path);
                 ;
             } else {
                 removed_files++;
@@ -554,9 +551,9 @@ cr_remove_metadata(const char *repopath)
             !g_strcmp0(file, "repomd.xml"))
         {
             gchar *path = g_strconcat(full_repopath, file, NULL);
-            g_debug(MODULE"%s: Removing: %s", __func__, path);
+            g_debug("%s: Removing: %s", __func__, path);
             if (g_remove(path) == -1)
-                g_warning(MODULE"%s: Cannot remove %s", __func__, path);
+                g_warning("%s: Cannot remove %s", __func__, path);
             else
                 removed_files++;
             g_free(path);
@@ -622,9 +619,9 @@ remove_listed_files(GSList *list, int retain)
     el = g_slist_nth(list, retain);
     for (; el; el = g_slist_next(el)) {
         OldFile *of = (OldFile *) el->data;
-        g_debug(MODULE"%s: Removing: %s", __func__, of->path);
+        g_debug("%s: Removing: %s", __func__, of->path);
         if (g_remove(of->path) == -1)
-            g_warning(MODULE"%s: Cannot remove %s", __func__, of->path);
+            g_warning("%s: Cannot remove %s", __func__, of->path);
         else
             removed++;
     }
@@ -643,14 +640,14 @@ cr_remove_metadata_classic(const char *repopath, int retain)
     GSList *oth_lst = NULL, *oth_db_lst = NULL;
 
     if (!repopath || !g_file_test(repopath, G_FILE_TEST_EXISTS|G_FILE_TEST_IS_DIR)) {
-        g_debug(MODULE"%s: remove_old_metadata: Cannot remove %s", __func__, repopath);
+        g_debug("%s: remove_old_metadata: Cannot remove %s", __func__, repopath);
         return -1;
     }
 
     full_repopath = g_strconcat(repopath, "/repodata/", NULL);
     repodir = g_dir_open(full_repopath, 0, NULL);
     if (!repodir) {
-        g_debug(MODULE"%s: Path %s doesn't exists", __func__, repopath);
+        g_debug("%s: Path %s doesn't exists", __func__, repopath);
         g_free(full_repopath);
         return -1;
     }
@@ -687,7 +684,7 @@ cr_remove_metadata_classic(const char *repopath, int retain)
     // Remove old metadata
 
     repomd_path = g_strconcat(full_repopath, "repomd.xml", NULL);
-    g_debug(MODULE"%s: Removing: %s", __func__, repomd_path);
+    g_debug("%s: Removing: %s", __func__, repomd_path);
     g_remove(repomd_path);
     g_free(repomd_path);
     g_free(full_repopath);
index ff406fa..1910c33 100644 (file)
 #include "constants.h"
 #include "misc.h"
 
-#undef MODULE
-#define MODULE "misc: "
-
-
 #define BUFFER_SIZE     4096
 
 
@@ -227,14 +223,14 @@ cr_compute_file_checksum(const char *filename, cr_ChecksumType type)
     GChecksumType gchecksumtype;
 
     if (!filename) {
-        g_debug(MODULE"%s: Filename param is NULL", __func__);
+        g_debug("%s: Filename param is NULL", __func__);
         return NULL;
     }
 
     // Check if file exists and if it is a regular file (not a directory)
 
     if (!g_file_test(filename, (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR))) {
-        g_debug(MODULE"%s: File %s doesn't exists", __func__, filename);
+        g_debug("%s: File %s doesn't exists", __func__, filename);
         return NULL;
     }
 
@@ -252,7 +248,7 @@ cr_compute_file_checksum(const char *filename, cr_ChecksumType type)
             gchecksumtype = G_CHECKSUM_SHA256;
             break;
         default:
-            g_debug(MODULE"%s: Unknown checksum type", __func__);
+            g_debug("%s: Unknown checksum type", __func__);
             return NULL;
     };
 
@@ -261,7 +257,7 @@ cr_compute_file_checksum(const char *filename, cr_ChecksumType type)
 
     FILE *fp = fopen(filename, "rb");
     if (!fp) {
-        g_critical(MODULE"%s: Cannot open %s (%s)", __func__, filename,
+        g_critical("%s: Cannot open %s (%s)", __func__, filename,
                                                     strerror(errno));
         return NULL;
     }
@@ -291,7 +287,7 @@ cr_compute_file_checksum(const char *filename, cr_ChecksumType type)
     g_checksum_free(checksum);
 
     if (!checksum_str) {
-        g_critical(MODULE"%s: Cannot get checksum %s (low memory?)", __func__,
+        g_critical("%s: Cannot get checksum %s (low memory?)", __func__,
                    filename);
     }
 
@@ -320,7 +316,7 @@ cr_get_header_byte_range(const char *filename)
 
     FILE *fp = fopen(filename, "rb");
     if (!fp) {
-        g_debug(MODULE"%s: Cannot open file %s (%s)", __func__, filename,
+        g_debug("%s: Cannot open file %s (%s)", __func__, filename,
                 strerror(errno));
         return results;
     }
@@ -329,7 +325,7 @@ cr_get_header_byte_range(const char *filename)
     // Get header range
 
     if (fseek(fp, 104, SEEK_SET) != 0) {
-        g_debug(MODULE"%s: fseek fail on %s (%s)", __func__, filename,
+        g_debug("%s: fseek fail on %s (%s)", __func__, filename,
                 strerror(errno));
         fclose(fp);
         return results;
@@ -368,7 +364,7 @@ cr_get_header_byte_range(const char *filename)
     // Check sanity
 
     if (hdrend < hdrstart) {
-        g_debug(MODULE"%s: sanity check fail on %s (%d > %d))", __func__,
+        g_debug("%s: sanity check fail on %s (%d > %d))", __func__,
                 filename, hdrstart, hdrend);
         return results;
     }
@@ -396,7 +392,7 @@ cr_checksum_name_str(cr_ChecksumType type)
             name = "sha256";
             break;
         default:
-            g_debug(MODULE"%s: Unknown checksum (%d)", __func__, type);
+            g_debug("%s: Unknown checksum (%d)", __func__, type);
             break;
     }
 
@@ -436,7 +432,7 @@ cr_copy_file(const char *src, const char *in_dst)
     FILE *new;
 
     if (!src || !in_dst) {
-        g_debug(MODULE"%s: File name cannot be NULL", __func__);
+        g_debug("%s: File name cannot be NULL", __func__);
         return CR_COPY_ERR;
     }
 
@@ -447,13 +443,13 @@ cr_copy_file(const char *src, const char *in_dst)
     }
 
     if ((orig = fopen(src, "r")) == NULL) {
-        g_debug(MODULE"%s: Cannot open source file %s (%s)", __func__, src,
+        g_debug("%s: Cannot open source file %s (%s)", __func__, src,
                 strerror(errno));
         return CR_COPY_ERR;
     }
 
     if ((new = fopen(dst, "w")) == NULL) {
-        g_debug(MODULE"%s: Cannot open destination file %s (%s)", __func__, dst,
+        g_debug("%s: Cannot open destination file %s (%s)", __func__, dst,
                 strerror(errno));
         fclose(orig);
         return CR_COPY_ERR;
@@ -461,7 +457,7 @@ cr_copy_file(const char *src, const char *in_dst)
 
     while ((readed = fread(buf, 1, BUFFER_SIZE, orig)) > 0) {
         if (fwrite(buf, 1, readed, new) != readed) {
-            g_debug(MODULE"%s: Error while copy %s -> %s (%s)", __func__, src,
+            g_debug("%s: Error while copy %s -> %s (%s)", __func__, src,
                     dst, strerror(errno));
             fclose(new);
             fclose(orig);
@@ -469,7 +465,7 @@ cr_copy_file(const char *src, const char *in_dst)
         }
 
         if (readed != BUFFER_SIZE && ferror(orig)) {
-            g_debug(MODULE"%s: Error while copy %s -> %s (%s)", __func__, src,
+            g_debug("%s: Error while copy %s -> %s (%s)", __func__, src,
                     dst, strerror(errno));
             fclose(new);
             fclose(orig);
@@ -501,13 +497,13 @@ cr_compress_file(const char *src,
     CR_FILE *new;
 
     if (!src) {
-        g_debug(MODULE"%s: File name cannot be NULL", __func__);
+        g_debug("%s: File name cannot be NULL", __func__);
         return CR_COPY_ERR;
     }
 
     if (compression == CR_CW_AUTO_DETECT_COMPRESSION ||
         compression == CR_CW_UNKNOWN_COMPRESSION) {
-        g_debug(MODULE"%s: Bad compression type", __func__);
+        g_debug("%s: Bad compression type", __func__);
         return CR_COPY_ERR;
     }
 
@@ -515,7 +511,7 @@ cr_compress_file(const char *src,
     if (g_str_has_suffix(src, "/") ||
         !g_file_test(src, (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR))) 
     {
-        g_debug(MODULE"%s: Source (%s) must be directory!", __func__, src);
+        g_debug("%s: Source (%s) must be directory!", __func__, src);
         return CR_COPY_ERR;
     }
 
@@ -533,27 +529,27 @@ cr_compress_file(const char *src,
     }
 
     if ((orig = fopen(src, "r")) == NULL) {
-        g_debug(MODULE"%s: Cannot open source file %s (%s)", __func__, src,
+        g_debug("%s: Cannot open source file %s (%s)", __func__, src,
                 strerror(errno));
         return CR_COPY_ERR;
     }
 
     if ((new = cr_open(dst, CR_CW_MODE_WRITE, compression)) == NULL) {
-        g_debug(MODULE"%s: Cannot open destination file %s", __func__, dst);
+        g_debug("%s: Cannot open destination file %s", __func__, dst);
         fclose(orig);
         return CR_COPY_ERR;
     }
 
     while ((readed = fread(buf, 1, BUFFER_SIZE, orig)) > 0) {
         if (cr_write(new, buf, readed) != readed) {
-            g_debug(MODULE"%s: Error while copy %s -> %s", __func__, src, dst);
+            g_debug("%s: Error while copy %s -> %s", __func__, src, dst);
             cr_close(new);
             fclose(orig);
             return CR_COPY_ERR;
         }
 
         if (readed != BUFFER_SIZE && ferror(orig)) {
-            g_debug(MODULE"%s: Error while copy %s -> %s (%s)", __func__, src,
+            g_debug("%s: Error while copy %s -> %s (%s)", __func__, src,
                     dst, strerror(errno));
             cr_close(new);
             fclose(orig);
@@ -593,7 +589,7 @@ cr_download(CURL *handle, const char *url, const char *in_dst, char **error)
 
     file = fopen(dst, "w");
     if (!file) {
-        *error = g_strdup_printf(MODULE"%s: Cannot open %s", __func__, dst);
+        *error = g_strdup_printf("%s: Cannot open %s", __func__, dst);
         remove(dst);
         g_free(dst);
         return;
@@ -603,7 +599,7 @@ cr_download(CURL *handle, const char *url, const char *in_dst, char **error)
     // Set URL
 
     if (curl_easy_setopt(handle, CURLOPT_URL, url) != CURLE_OK) {
-        *error = g_strdup_printf(MODULE"%s: curl_easy_setopt(CURLOPT_URL) error",
+        *error = g_strdup_printf("%s: curl_easy_setopt(CURLOPT_URL) error",
                                  __func__);
         fclose(file);
         remove(dst);
@@ -615,7 +611,7 @@ cr_download(CURL *handle, const char *url, const char *in_dst, char **error)
     // Set output file descriptor
 
     if (curl_easy_setopt(handle, CURLOPT_WRITEDATA, file) != CURLE_OK) {
-        *error = g_strdup_printf(MODULE
+        *error = g_strdup_printf(
                         "%s: curl_easy_setopt(CURLOPT_WRITEDATA) error",
                          __func__);
         fclose(file);
@@ -626,7 +622,7 @@ cr_download(CURL *handle, const char *url, const char *in_dst, char **error)
 
     rcode = curl_easy_perform(handle);
     if (rcode != 0) {
-        *error = g_strdup_printf(MODULE"%s: curl_easy_perform() error: %s",
+        *error = g_strdup_printf("%s: curl_easy_perform() error: %s",
                                  __func__, curl_easy_strerror(rcode));
         fclose(file);
         remove(dst);
@@ -635,7 +631,7 @@ cr_download(CURL *handle, const char *url, const char *in_dst, char **error)
     }
 
 
-    g_debug(MODULE"%s: Successfully downloaded: %s", __func__, dst);
+    g_debug("%s: Successfully downloaded: %s", __func__, dst);
 
     fclose(file);
     g_free(dst);
@@ -656,7 +652,7 @@ cr_better_copy_file(const char *src, const char *in_dst)
     cr_download(handle, src, in_dst, &error);
     curl_easy_cleanup(handle);
     if (error) {
-        g_debug(MODULE"%s: Error while downloading %s: %s", __func__, src,
+        g_debug("%s: Error while downloading %s: %s", __func__, src,
                 error);
         return CR_COPY_ERR;
     }
index 208f9c8..263d8a3 100644 (file)
@@ -26,9 +26,6 @@
 #include "xml_dump.h"
 #include "misc.h"
 
-#undef MODULE
-#define MODULE "parsehdr: "
-
 
 inline gchar *
 safe_string_chunk_insert(GStringChunk *chunk, const char *str)
index 6ffc59a..8bf4eb6 100644 (file)
 #include "misc.h"
 #include "parsehdr.h"
 
-#undef MODULE
-#define MODULE "parsepkg: "
-
-
 volatile short cr_initialized = 0;
 rpmts ts = NULL;
 
@@ -54,7 +50,7 @@ cr_package_parser_init()
     rpmReadConfigFiles(NULL, NULL);
     ts = rpmtsCreate();
     if (!ts)
-        g_critical(MODULE"%s: rpmtsCreate() failed", __func__);
+        g_critical("%s: rpmtsCreate() failed", __func__);
 
     rpmVSFlags vsflags = 0;
     vsflags |= _RPMVSF_NODIGESTS;
@@ -69,7 +65,7 @@ cr_package_parser_init()
     // Work around for this shoud be use empty keyring.
     keyring = rpmKeyringNew();
     if (rpmtsSetKeyring(ts, keyring) == -1)
-        g_critical(MODULE"%s: rpmtsSetKeyring() failed", __func__);
+        g_critical("%s: rpmtsSetKeyring() failed", __func__);
     rpmKeyringFree(keyring);
 }
 
@@ -109,7 +105,7 @@ cr_package_from_file(const char *filename,
             checksum_type_str = "sha256";
             break;
         default:
-            g_warning(MODULE"%s: Unknown checksum type", __func__);
+            g_warning("%s: Unknown checksum type", __func__);
             return result;
             break;
     };
@@ -120,7 +116,7 @@ cr_package_from_file(const char *filename,
     FD_t fd = NULL;
     fd = Fopen(filename, "r.ufdio");
     if (!fd) {
-        g_warning(MODULE"%s: Fopen of %s failed %s",
+        g_warning("%s: Fopen of %s failed %s",
                   __func__, filename, strerror(errno));
         return result;
     }
@@ -133,15 +129,15 @@ cr_package_from_file(const char *filename,
     if (rc != RPMRC_OK) {
         switch (rc) {
             case RPMRC_NOKEY:
-                g_debug(MODULE"%s: %s: Public key is unavailable.",
+                g_debug("%s: %s: Public key is unavailable.",
                         __func__, filename);
                 break;
             case RPMRC_NOTTRUSTED:
-                g_debug(MODULE"%s:  %s: Signature is OK, but key is not trusted.",
+                g_debug("%s:  %s: Signature is OK, but key is not trusted.",
                         __func__, filename);
                 break;
             default:
-                g_warning(MODULE"%s: rpmReadPackageFile() error (%s)",
+                g_warning("%s: rpmReadPackageFile() error (%s)",
                           __func__, strerror(errno));
                 return result;
         }
@@ -161,7 +157,7 @@ cr_package_from_file(const char *filename,
     if (!stat_buf) {
         struct stat stat_buf_own;
         if (stat(filename, &stat_buf_own) == -1) {
-            g_warning(MODULE"%s: stat() error (%s)", __func__, strerror(errno));
+            g_warning("%s: stat() error (%s)", __func__, strerror(errno));
             return result;
         }
         mtime  = stat_buf_own.st_mtime;
@@ -228,7 +224,7 @@ cr_xml_from_package_file(const char *filename,
             checksum_type_str = "sha256";
             break;
         default:
-            g_warning(MODULE"%s: Unknown checksum type", __func__);
+            g_warning("%s: Unknown checksum type", __func__);
             return result;
             break;
     };
@@ -239,7 +235,7 @@ cr_xml_from_package_file(const char *filename,
     FD_t fd = NULL;
     fd = Fopen(filename, "r.ufdio");
     if (!fd) {
-        g_warning(MODULE"%s: Fopen failed %s", __func__, strerror(errno));
+        g_warning("%s: Fopen failed %s", __func__, strerror(errno));
         return result;
     }
 
@@ -251,15 +247,15 @@ cr_xml_from_package_file(const char *filename,
     if (rc != RPMRC_OK) {
         switch (rc) {
             case RPMRC_NOKEY:
-                g_debug(MODULE"%s: %s: Public key is unavailable.",
+                g_debug("%s: %s: Public key is unavailable.",
                         __func__, filename);
                 break;
             case RPMRC_NOTTRUSTED:
-                g_debug(MODULE"%s:  %s: Signature is OK, but key is not trusted.",
+                g_debug("%s:  %s: Signature is OK, but key is not trusted.",
                         __func__, filename);
                 break;
             default:
-                g_warning(MODULE"%s: rpmReadPackageFile() error (%s)",
+                g_warning("%s: rpmReadPackageFile() error (%s)",
                           __func__, strerror(errno));
                 return result;
         }
@@ -279,7 +275,7 @@ cr_xml_from_package_file(const char *filename,
     if (!stat_buf) {
         struct stat stat_buf_own;
         if (stat(filename, &stat_buf_own) == -1) {
-            g_warning(MODULE"%s: stat() error (%s)", __func__, strerror(errno));
+            g_warning("%s: stat() error (%s)", __func__, strerror(errno));
             return result;
         }
         mtime  = stat_buf_own.st_mtime;
index 99119f2..7d5aceb 100644 (file)
@@ -30,9 +30,6 @@
 #include "repomd.h"
 #include "compression_wrapper.h"
 
-#undef MODULE
-#define MODULE "repomd: "
-
 #define LOCATION_HREF_PREFIX            "repodata/"
 
 #define DEFAULT_DATABASE_VERSION        10
@@ -138,7 +135,7 @@ get_compressed_content_stat(const char *filename, cr_ChecksumType checksum_type)
             gchecksumtype = G_CHECKSUM_SHA256;
             break;
         default:
-            g_critical(MODULE"%s: Unknown checksum type", __func__);
+            g_critical("%s: Unknown checksum type", __func__);
             return NULL;
     };
 
@@ -147,7 +144,7 @@ get_compressed_content_stat(const char *filename, cr_ChecksumType checksum_type)
 
     GChecksum *checksum = g_checksum_new(gchecksumtype);
     if (!checksum) {
-        g_critical(MODULE"%s: g_checksum_new() failed", __func__);
+        g_critical("%s: g_checksum_new() failed", __func__);
         return NULL;
     }
 
@@ -158,7 +155,7 @@ get_compressed_content_stat(const char *filename, cr_ChecksumType checksum_type)
     do {
         readed = cr_read(cwfile, (void *) buffer, BUFFER_SIZE);
         if (readed == CR_CW_ERR) {
-            g_debug(MODULE"%s: Error while read compressed file: %s",
+            g_debug("%s: Error while read compressed file: %s",
                     __func__, filename);
             break;
         }
@@ -205,7 +202,7 @@ cr_fill_repomdrecord(cr_RepomdRecord md, cr_ChecksumType checksum_type)
 
     if (!g_file_test(path, G_FILE_TEST_EXISTS|G_FILE_TEST_IS_REGULAR)) {
         // File doesn't exists
-        g_warning(MODULE"%s: File %s doesn't exists", __func__, path);
+        g_warning("%s: File %s doesn't exists", __func__, path);
         return REPOMD_ERR;
     }
 
@@ -239,7 +236,7 @@ cr_fill_repomdrecord(cr_RepomdRecord md, cr_ChecksumType checksum_type)
             g_free(open_stat);
         } else {
             // Unknown compression
-            g_warning(MODULE"%s: File \"%s\" compressed by an unsupported type"
+            g_warning("%s: File \"%s\" compressed by an unsupported type"
                       " of compression", __func__, path);
             md->checksum_open_type = g_string_chunk_insert(md->chunk, "UNKNOWN");
             md->checksum_open = g_string_chunk_insert(md->chunk,
@@ -261,7 +258,7 @@ cr_fill_repomdrecord(cr_RepomdRecord md, cr_ChecksumType checksum_type)
                 md->size = buf.st_size;
             }
         } else {
-            g_warning(MODULE"%s: Stat on file \"%s\" failed", __func__, path);
+            g_warning("%s: Stat on file \"%s\" failed", __func__, path);
         }
     }
 
@@ -326,7 +323,7 @@ cr_process_groupfile_repomdrecord(cr_RepomdRecord groupfile,
 
     if (!g_file_test(path, G_FILE_TEST_EXISTS|G_FILE_TEST_IS_REGULAR)) {
         // File doesn't exists
-        g_warning(MODULE"%s: File %s doesn't exists", __func__, path);
+        g_warning("%s: File %s doesn't exists", __func__, path);
         return;
     }
 
@@ -338,7 +335,7 @@ cr_process_groupfile_repomdrecord(cr_RepomdRecord groupfile,
 
     while ((readed = cr_read(cw_plain, buf, BUFFER_SIZE)) > 0) {
         if (cr_write(cw_compressed, buf, (unsigned int) readed) == CR_CW_ERR) {
-            g_debug(MODULE"%s: Error while groupfile compression", __func__);
+            g_debug("%s: Error while groupfile compression", __func__);
             break;
         }
     }
@@ -347,7 +344,7 @@ cr_process_groupfile_repomdrecord(cr_RepomdRecord groupfile,
     cr_close(cw_plain);
 
     if (readed == CR_CW_ERR) {
-        g_debug(MODULE"%s: Error while groupfile compression", __func__);
+        g_debug("%s: Error while groupfile compression", __func__);
     }
 
 
@@ -360,14 +357,14 @@ cr_process_groupfile_repomdrecord(cr_RepomdRecord groupfile,
     // Get stats
 
     if (stat(path, &gf_stat)) {
-        g_debug(MODULE"%s: Error while stat() on %s", __func__, path);
+        g_debug("%s: Error while stat() on %s", __func__, path);
     } else {
         gf_size = gf_stat.st_size;
         gf_time = gf_stat.st_mtime;
     }
 
     if (stat(cpath, &cgf_stat)) {
-        g_debug(MODULE"%s: Error while stat() on %s", __func__, path);
+        g_debug("%s: Error while stat() on %s", __func__, path);
     } else {
         cgf_size = cgf_stat.st_size;
         cgf_time = cgf_stat.st_mtime;
@@ -585,7 +582,7 @@ cr_rename_repomdrecord_file(cr_RepomdRecord md)
     // Rename file
     if (g_file_test (new_location_real, G_FILE_TEST_EXISTS)) {
         if (remove(new_location_real)) {
-            g_critical(MODULE"%s: Cannot delete old %s",
+            g_critical("%s: Cannot delete old %s",
                        __func__,
                        new_location_real);
             g_free(new_location_real);
@@ -593,7 +590,7 @@ cr_rename_repomdrecord_file(cr_RepomdRecord md)
         }
     }
     if (rename(md->location_real, new_location_real)) {
-        g_critical(MODULE"%s: Cannot rename %s to %s",
+        g_critical("%s: Cannot rename %s to %s",
                    __func__,
                    md->location_real,
                    new_location_real);
index 4ec32e6..753035c 100644 (file)
  * USA.
  */
 
-/*
-TODO:
-- Fix possible license issue of this module!!!
-  - Relicensins whole project to GPLv2?
-  - Rewrite sqlite module?
-*/
-
 #include <glib.h>
 #include <string.h>
 #include <stdlib.h>
@@ -36,9 +29,6 @@ TODO:
 #include "misc.h"
 #include "sqlite.h"
 
-#undef MODULE
-#define MODULE "sqlite: "
-
 #define ENCODED_PACKAGE_FILE_FILES 2048
 #define ENCODED_PACKAGE_FILE_TYPES 60