From: Tomas Mlcoch Date: Tue, 20 Mar 2012 14:11:41 +0000 (+0100) Subject: use __func__ in logging functions X-Git-Tag: upstream/0.2.1~479 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f80e13876cf67689ed46a5f0876c2e2c3b3f8a39;p=services%2Fcreaterepo_c.git use __func__ in logging functions --- diff --git a/src/compression_wrapper.c b/src/compression_wrapper.c index 852fb89..e2a95b9 100644 --- a/src/compression_wrapper.c +++ b/src/compression_wrapper.c @@ -26,7 +26,7 @@ #define Z_DEFAULT_STRATEGY 0 */ #define GZ_STRATEGY Z_DEFAULT_STRATEGY -#define GZ_BUFFER_SIZE 131072 // 1024 * 128 +#define GZ_BUFFER_SIZE (1024*128) #define BZ2_VERBOSITY 0 #define BZ2_WORK_FACTOR 30 @@ -59,14 +59,14 @@ CompressionType detect_compression(const char *filename) magic_t myt = magic_open(MAGIC_MIME_TYPE); magic_load(myt, NULL); if (magic_check(myt, NULL) == -1) { - g_critical(MODULE"detect_compression: magic_check() failed"); + g_critical(MODULE"%s: magic_check() failed", __func__); return type; } const char *mime_type = magic_file(myt, filename); if (mime_type) { - g_debug(MODULE"detect_compression: Detected mime type: %s", mime_type); + g_debug(MODULE"%s: Detected mime type: %s", __func__, mime_type); if (g_str_has_suffix(mime_type, "gzip") || g_str_has_suffix(mime_type, "gunzip")) @@ -82,7 +82,7 @@ CompressionType detect_compression(const char *filename) type = NO_COMPRESSION; } } else { - g_debug(MODULE"detect_compression: Mime type not detected!"); + g_debug(MODULE"%s: Mime type not detected!", __func__); } magic_close(myt); @@ -140,7 +140,7 @@ CW_FILE *cw_open(const char *filename, int mode, CompressionType comtype) } if (gzbuffer((gzFile) file->FILE, GZ_BUFFER_SIZE) == -1) { - g_debug(MODULE"cw_open: gzbuffer() call failed"); + g_debug(MODULE"%s: gzbuffer() call failed", __func__); } break; @@ -368,7 +368,7 @@ int cw_printf(CW_FILE *cw_file, const char *format, ...) va_end(vl); if (ret < 0) { - g_debug(MODULE"cw_printf: vasprintf() call failed"); + g_debug(MODULE"%s: vasprintf() call failed", __func__); return CW_ERR; } diff --git a/src/load_metadata.c b/src/load_metadata.c index a6bd08c..951e9d5 100644 --- a/src/load_metadata.c +++ b/src/load_metadata.c @@ -127,7 +127,7 @@ void process_node(GHashTable *metadata, xmlTextReaderPtr pri_reader, pri_pkg_xml = g_strndup((char *) xmlBufferContent(buf), (gsize) len); } else { pri_pkg_xml = NULL; - g_critical(MODULE"process_node: xmlNodeDump() [primary.xml] failed"); + g_critical(MODULE"%s: xmlNodeDump() [primary.xml] failed", __func__); } xmlBufferEmpty(buf); @@ -137,7 +137,7 @@ void process_node(GHashTable *metadata, xmlTextReaderPtr pri_reader, fil_pkg_xml = g_strndup((char *) xmlBufferContent(buf), (gsize) len); } else { fil_pkg_xml = NULL; - g_critical(MODULE"process_node: xmlNodeDump() [filelists.xml] failed"); + g_critical(MODULE"%s: xmlNodeDump() [filelists.xml] failed", __func__); } xmlBufferEmpty(buf); @@ -147,7 +147,7 @@ void process_node(GHashTable *metadata, xmlTextReaderPtr pri_reader, oth_pkg_xml = g_strndup((char *) xmlBufferContent(buf), (gsize) len); } else { oth_pkg_xml = NULL; - g_critical(MODULE"process_node: xmlNodeDump() [other.xml] failed"); + g_critical(MODULE"%s: xmlNodeDump() [other.xml] failed", __func__); } xmlBufferFree(buf); @@ -201,7 +201,7 @@ void process_node(GHashTable *metadata, xmlTextReaderPtr pri_reader, } if ( counter != 4 || !location_href || !checksum_type) { - g_warning(MODULE"process_node: Bad xml data! Some information are missing (for package: %s)!", location_href); + g_warning(MODULE"%s: Bad xml data! Some information are missing (for package: %s)!", __func__, location_href); g_free(pri_pkg_xml); g_free(fil_pkg_xml); g_free(oth_pkg_xml); @@ -224,7 +224,7 @@ void process_node(GHashTable *metadata, xmlTextReaderPtr pri_reader, // Check if key already exists if (g_hash_table_lookup(metadata, key)) { - g_debug(MODULE"process_node: Warning: Key \"%s\" already exists in old metadata\n", key); + g_debug(MODULE"%s: Warning: Key \"%s\" already exists in old metadata\n", __func__, key); g_free(pri_pkg_xml); g_free(fil_pkg_xml); g_free(oth_pkg_xml); @@ -298,7 +298,7 @@ int parse_xml_metadata(GHashTable *hashtable, xmlTextReaderPtr pri_reader, xmlTe pri_ret = xmlTextReaderRead(pri_reader); name = xmlTextReaderName(pri_reader); if (g_strcmp0((char *) name, "package")) { - g_warning(MODULE"parse_xml_metadata: Probably bad xml"); + g_warning(MODULE"%s: Probably bad xml", __func__); xmlFree(name); return 0; } @@ -307,7 +307,7 @@ int parse_xml_metadata(GHashTable *hashtable, xmlTextReaderPtr pri_reader, xmlTe fil_ret = xmlTextReaderRead(fil_reader); name = xmlTextReaderName(fil_reader); if (g_strcmp0((char *) name, "package")) { - g_warning(MODULE"parse_xml_metadata: Probably bad xml"); + g_warning(MODULE"%s: Probably bad xml", __func__); xmlFree(name); return 0; } @@ -316,7 +316,7 @@ int parse_xml_metadata(GHashTable *hashtable, xmlTextReaderPtr pri_reader, xmlTe oth_ret = xmlTextReaderRead(oth_reader); name = xmlTextReaderName(oth_reader); if (g_strcmp0((char *) name, "package")) { - g_warning(MODULE"parse_xml_metadata: Probably bad xml"); + g_warning(MODULE"%s: Probably bad xml", __func__); xmlFree(name); return 0; } @@ -337,7 +337,7 @@ int parse_xml_metadata(GHashTable *hashtable, xmlTextReaderPtr pri_reader, xmlTe int load_compressed_xml_metadata(GHashTable *hashtable, const char *primary_xml_path, const char *filelists_xml_path, const char *other_xml_path) { if (!hashtable) { - g_debug(MODULE"load_compressed_xml_metadata: No hash table passed"); + g_debug(MODULE"%s: No hash table passed", __func__); return 0; } @@ -346,7 +346,7 @@ int load_compressed_xml_metadata(GHashTable *hashtable, const char *primary_xml_ !g_file_test(filelists_xml_path, flags) || !g_file_test(other_xml_path, flags)) { - g_debug(MODULE"load_compressed_xml_metadata: One or more files don't exist"); + g_debug(MODULE"%s: One or more files don't exist", __func__); return 0; } @@ -354,7 +354,7 @@ int load_compressed_xml_metadata(GHashTable *hashtable, const char *primary_xml_ CompressionType c_type; c_type = detect_compression(primary_xml_path); if (c_type == UNKNOWN_COMPRESSION || c_type == NO_COMPRESSION) { - g_debug(MODULE"load_compressed_xml_metadata: Unknown compression"); + g_debug(MODULE"%s: Unknown compression", __func__); return 0; } @@ -390,7 +390,7 @@ int load_compressed_xml_metadata(GHashTable *hashtable, const char *primary_xml_ NULL, XML_PARSE_NOBLANKS); if (!pri_reader) { - g_critical(MODULE"load_compressed_xml_metadata: Reader for primary.xml.* file failed"); + g_critical(MODULE"%s: Reader for primary.xml.* file failed", __func__); cw_close(pri_xml_cwfile); cw_close(fil_xml_cwfile); cw_close(oth_xml_cwfile); @@ -404,7 +404,7 @@ int load_compressed_xml_metadata(GHashTable *hashtable, const char *primary_xml_ NULL, XML_PARSE_NOBLANKS); if (!fil_reader) { - g_critical(MODULE"load_compressed_xml_metadata: Reader for filelists.xml.* file failed"); + g_critical(MODULE"%s: Reader for filelists.xml.* file failed", __func__); xmlFreeTextReader(pri_reader); cw_close(fil_xml_cwfile); cw_close(oth_xml_cwfile); @@ -418,7 +418,7 @@ int load_compressed_xml_metadata(GHashTable *hashtable, const char *primary_xml_ NULL, XML_PARSE_NOBLANKS); if (!oth_reader) { - g_critical(MODULE"load_compressed_xml_metadata: Reader for other.xml.* file failed"); + g_critical(MODULE"%s: Reader for other.xml.* file failed", __func__); xmlFreeTextReader(pri_reader); xmlFreeTextReader(fil_reader); cw_close(oth_xml_cwfile); @@ -438,7 +438,7 @@ int load_compressed_xml_metadata(GHashTable *hashtable, const char *primary_xml_ int load_xml_metadata(GHashTable *hashtable, const char *primary_xml_path, const char *filelists_xml_path, const char *other_xml_path) { if (!hashtable) { - g_debug(MODULE"load_xml_metadata: No hash table passed"); + g_debug(MODULE"%s: No hash table passed", __func__); return 0; } @@ -447,7 +447,7 @@ int load_xml_metadata(GHashTable *hashtable, const char *primary_xml_path, const !g_file_test(filelists_xml_path, flags) || !g_file_test(other_xml_path, flags)) { - g_debug(MODULE"load_xml_metadata: One or more files don't exist"); + g_debug(MODULE"%s: One or more files don't exist", __func__); return 0; } @@ -467,7 +467,7 @@ int load_xml_metadata(GHashTable *hashtable, const char *primary_xml_path, const NULL, XML_PARSE_NOBLANKS); if (!pri_reader) { - g_critical(MODULE"load_xml_metadata: Reader for primary.xml file failed"); + g_critical(MODULE"%s: Reader for primary.xml file failed", __func__); fclose(pri_xml_file); fclose(fil_xml_file); fclose(oth_xml_file); @@ -481,7 +481,7 @@ int load_xml_metadata(GHashTable *hashtable, const char *primary_xml_path, const NULL, XML_PARSE_NOBLANKS); if (!fil_reader) { - g_critical(MODULE"load_xml_metadata: Reader for filelists.xml file failed"); + g_critical(MODULE"%s: Reader for filelists.xml file failed", __func__); xmlFreeTextReader(pri_reader); fclose(fil_xml_file); fclose(oth_xml_file); @@ -539,7 +539,7 @@ struct MetadataLocation *locate_metadata_via_repomd(const char *repopath) { } if (!g_file_test(repomd, G_FILE_TEST_EXISTS)) { - g_debug(MODULE"locate_metadata_via_repomd: %s doesn't exists", repomd); + g_debug(MODULE"%s: %s doesn't exists", __func__, repomd); g_free(repomd); return NULL; } @@ -555,7 +555,7 @@ struct MetadataLocation *locate_metadata_via_repomd(const char *repopath) { ret = xmlTextReaderRead(reader); name = xmlTextReaderName(reader); if (g_strcmp0((char *) name, "repomd")) { - g_warning(MODULE"locate_metadata_via_repomd: Bad xml - missing repomd element? (%s)", name); + g_warning(MODULE"%s: Bad xml - missing repomd element? (%s)", __func__, name); xmlFree(name); xmlFreeTextReader(reader); g_free(repomd); @@ -566,7 +566,7 @@ struct MetadataLocation *locate_metadata_via_repomd(const char *repopath) { ret = xmlTextReaderRead(reader); name = xmlTextReaderName(reader); if (g_strcmp0((char *) name, "revision")) { - g_warning(MODULE"locate_metadata_via_repomd: Bad xml - missing revision element? (%s)", name); + g_warning(MODULE"%s: Bad xml - missing revision element? (%s)", __func__, name); xmlFree(name); xmlFreeTextReader(reader); g_free(repomd); @@ -590,7 +590,7 @@ struct MetadataLocation *locate_metadata_via_repomd(const char *repopath) { if (!ret) { // No elements left -> Bad xml - g_warning(MODULE"locate_metadata_vie_repomd: Bad xml - missing data elements?"); + g_warning(MODULE"%s: Bad xml - missing data elements?", __func__); xmlFreeTextReader(reader); g_free(repomd); return NULL; @@ -762,7 +762,7 @@ int remove_old_metadata(const char *repopath) GDir *repodir; repodir = g_dir_open(full_repopath, 0, NULL); if (!repodir) { - g_debug(MODULE"remove_old_metadata: Path %s doesn't exists", repopath); + g_debug(MODULE"%s: Path %s doesn't exists", __func__, repopath); return -1; } @@ -780,9 +780,9 @@ int remove_old_metadata(const char *repopath) for (element=list; element; element=element->next) { gchar *path = (char *) element->data; - g_debug(MODULE"Removing: %s (path obtained from repomd.xml)", path); + g_debug("%s: Removing: %s (path obtained from repomd.xml)", __func__, path); if (g_remove(path) == -1) { - g_warning(MODULE"remove_old_metadata: Cannot remove %s", path); + g_warning("%s: remove_old_metadata: Cannot remove %s", __func__, path); } else { removed_files++; } @@ -811,9 +811,9 @@ int remove_old_metadata(const char *repopath) gchar *path; path = g_strconcat(full_repopath, file, NULL); - g_debug(MODULE"Removing: %s", path); + g_debug(MODULE"%s: Removing: %s", __func__, path); if (g_remove(path) == -1) { - g_warning(MODULE"remove_old_metadata: Cannot remove %s", path); + g_warning(MODULE"%s: Cannot remove %s", __func__, path); } else { removed_files++; } diff --git a/src/misc.c b/src/misc.c index 07fedde..2a531c5 100644 --- a/src/misc.c +++ b/src/misc.c @@ -196,7 +196,7 @@ char *compute_file_checksum(const char *filename, ChecksumType type) // 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_critical(MODULE"compute_file_checksum: File %s doesn't exists", filename); + g_critical(MODULE"%s: File %s doesn't exists", __func__, filename); return NULL; } @@ -214,7 +214,7 @@ char *compute_file_checksum(const char *filename, ChecksumType type) gchecksumtype = G_CHECKSUM_SHA256; break; default: - g_critical(MODULE"compute_file_checksum: Unknown checksum type"); + g_critical(MODULE"%s: Unknown checksum type", __func__); return NULL; }; @@ -223,7 +223,7 @@ char *compute_file_checksum(const char *filename, ChecksumType type) FILE *fp = fopen(filename, "rb"); if (!fp) { - g_critical(MODULE"compute_file_checksum: Cannot open %s (%s)", filename, strerror(errno)); + g_critical(MODULE"%s: Cannot open %s (%s)", __func__, filename, strerror(errno)); return NULL; } @@ -251,7 +251,7 @@ char *compute_file_checksum(const char *filename, ChecksumType type) g_checksum_free(checksum); if (!checksum_str) { - g_critical(MODULE"compute_file_checksum: Cannot get checksum %s (low memory?)", filename); + g_critical(MODULE"%s: Cannot get checksum %s (low memory?)", __func__, filename); } return checksum_str; @@ -277,7 +277,7 @@ struct HeaderRangeStruct get_header_byte_range(const char *filename) FILE *fp = fopen(filename, "rb"); if (!fp) { - g_critical(MODULE"get_header_byte_range: Cannot open file %s (%s)", filename, strerror(errno)); + g_critical(MODULE"%s: Cannot open file %s (%s)", __func__, filename, strerror(errno)); return results; } @@ -285,7 +285,7 @@ struct HeaderRangeStruct get_header_byte_range(const char *filename) // Get header range if (fseek(fp, 104, SEEK_SET) != 0) { - g_critical(MODULE"get_header_byte_range: fseek fail on %s (%s)", filename, strerror(errno)); + g_critical(MODULE"%s: fseek fail on %s (%s)", __func__, filename, strerror(errno)); fclose(fp); return results; } @@ -323,7 +323,7 @@ struct HeaderRangeStruct get_header_byte_range(const char *filename) // Check sanity if (hdrend < hdrstart) { - g_critical(MODULE"get_header_byte_range: sanity check fail on %s (%d > %d))", filename, hdrstart, hdrend); + g_critical(MODULE"%s: sanity check fail on %s (%d > %d))", __func__, filename, hdrstart, hdrend); return results; } @@ -349,7 +349,7 @@ const char *get_checksum_name_str(ChecksumType type) name = "sha256"; break; default: - g_debug(MODULE"get_checksum_name_str: Unknown checksum"); + g_debug(MODULE"%s: Unknown checksum", __func__); break; } @@ -388,26 +388,26 @@ int copy_file(const char *src, const char *dst) FILE *new; if ((orig = fopen(src, "r")) == NULL) { - g_debug(MODULE"copy_file: Cannot open source file %s (%s)", src, strerror(errno)); + g_debug(MODULE"%s: Cannot open source file %s (%s)", __func__, src, strerror(errno)); return CR_COPY_ERR; } if ((new = fopen(dst, "w")) == NULL) { - g_debug(MODULE"copy_file: Cannot open destination file %s (%s)", dst, strerror(errno)); + g_debug(MODULE"%s: Cannot open destination file %s (%s)", __func__, dst, strerror(errno)); fclose(orig); return CR_COPY_ERR; } while ((readed = fread(buf, 1, BUFFER_SIZE, orig)) > 0) { if (fwrite(buf, 1, readed, new) != readed) { - g_debug(MODULE"copy_file: Error while copy %s -> %s (%s)", src, dst, strerror(errno)); + g_debug(MODULE"%s: Error while copy %s -> %s (%s)", __func__, src, dst, strerror(errno)); fclose(new); fclose(orig); return CR_COPY_ERR; } if (readed != BUFFER_SIZE && ferror(orig)) { - g_debug(MODULE"copy_file: Error while copy %s -> %s (%s)", src, dst, strerror(errno)); + g_debug(MODULE"%s: Error while copy %s -> %s (%s)", __func__, src, dst, strerror(errno)); fclose(new); fclose(orig); return CR_COPY_ERR; diff --git a/src/parsepkg.c b/src/parsepkg.c index 11e7deb..5ce1936 100644 --- a/src/parsepkg.c +++ b/src/parsepkg.c @@ -29,7 +29,7 @@ void init_package_parser() rpmReadConfigFiles(NULL, NULL); ts = rpmtsCreate(); if (!ts) { - g_critical(MODULE"init_package_parser: rpmtsCreate() failed"); + g_critical(MODULE"%s: rpmtsCreate() failed", __func__); } rpmVSFlags vsflags = 0; @@ -78,7 +78,7 @@ struct XmlStruct xml_from_package_file(const char *filename, ChecksumType checks checksum_type_str = "sha256"; break; default: - g_critical(MODULE"Unknown checksum type"); + g_critical(MODULE"%s: Unknown checksum type", __func__); return result; break; }; @@ -89,7 +89,7 @@ struct XmlStruct xml_from_package_file(const char *filename, ChecksumType checks FD_t fd = NULL; fd = Fopen(filename, "r.ufdio"); if (!fd) { - g_critical(MODULE"xml_from_package_file: Fopen failed %s", strerror(errno)); + g_critical(MODULE"%s: Fopen failed %s", __func__, strerror(errno)); return result; } @@ -101,13 +101,13 @@ struct XmlStruct xml_from_package_file(const char *filename, ChecksumType checks if (rc != RPMRC_OK) { switch (rc) { case RPMRC_NOKEY: - g_debug(MODULE"xml_from_package_file: %s: Public key is unavailable.", filename); + g_debug(MODULE"%s: %s: Public key is unavailable.", __func__, filename); break; case RPMRC_NOTTRUSTED: - g_debug(MODULE"xml_from_package_file: %s: Signature is OK, but key is not trusted.", filename); + g_debug(MODULE"%s: %s: Signature is OK, but key is not trusted.", __func__, filename); break; default: - g_critical(MODULE"xml_from_package_file: rpmReadPackageFile() error (%s)", strerror(errno)); + g_critical(MODULE"%s: rpmReadPackageFile() error (%s)", __func__, strerror(errno)); return result; } } @@ -126,7 +126,7 @@ struct XmlStruct xml_from_package_file(const char *filename, ChecksumType checks if (!stat_buf) { struct stat stat_buf_own; if (stat(filename, &stat_buf_own) == -1) { - g_critical(MODULE"xml_from_package_file: stat() error (%s)", strerror(errno)); + g_critical(MODULE"%s: stat() error (%s)", __func__, strerror(errno)); return result; } mtime = stat_buf_own.st_mtime; diff --git a/src/repomd.c b/src/repomd.c index 20053ea..f2b1b82 100644 --- a/src/repomd.c +++ b/src/repomd.c @@ -124,7 +124,7 @@ contentStat *get_compressed_content_stat(const char *filename, ChecksumType chec gchecksumtype = G_CHECKSUM_SHA256; break; default: - g_critical(MODULE"get_compressed_content_stat: Unknown checksum type"); + g_critical(MODULE"%s: Unknown checksum type", __func__); return NULL; }; @@ -133,7 +133,7 @@ contentStat *get_compressed_content_stat(const char *filename, ChecksumType chec GChecksum *checksum = g_checksum_new(gchecksumtype); if (!checksum) { - g_critical(MODULE"get_compressed_content_stat: g_checksum_new() failed"); + g_critical(MODULE"%s: g_checksum_new() failed", __func__); return NULL; } @@ -185,7 +185,7 @@ int fill_missing_data(const char *base_path, struct repomdData *md, ChecksumType if (!g_file_test(path, G_FILE_TEST_EXISTS|G_FILE_TEST_IS_REGULAR)) { // File doesn't exists - g_warning(MODULE"fill_missing_data: File %s doesn't exists", path); + g_warning(MODULE"%s: File %s doesn't exists", __func__, path); return REPOMD_ERR; } @@ -219,7 +219,7 @@ int fill_missing_data(const char *base_path, struct repomdData *md, ChecksumType g_free(open_stat); } else { // Unknown compression - g_warning(MODULE"File \"%s\" compressed by an unsupported type of compression", path); + g_warning(MODULE"%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, "file_compressed_by_an_unsupported_type_of_compression"); md->size_open = -1; @@ -239,7 +239,7 @@ int fill_missing_data(const char *base_path, struct repomdData *md, ChecksumType md->size = buf.st_size; } } else { - g_warning(MODULE"Stat on file \"%s\" failed", path); + g_warning(MODULE"%s: Stat on file \"%s\" failed", __func__, path); } } @@ -286,7 +286,7 @@ void process_groupfile(const char *base_path, struct repomdData *groupfile, if (!g_file_test(path, G_FILE_TEST_EXISTS|G_FILE_TEST_IS_REGULAR)) { // File doesn't exists - g_warning(MODULE"process_groupfile: File %s doesn't exists", path); + g_warning(MODULE"%s: File %s doesn't exists", __func__, path); g_free(path); g_free(cpath); return; @@ -305,7 +305,7 @@ void process_groupfile(const char *base_path, struct repomdData *groupfile, while ((readed = cw_read(cw_plain, buf, BUFFER_SIZE)) > 0) { if (cw_write(cw_compressed, buf, (unsigned int) readed) == CW_ERR) { - g_debug(MODULE"process_groupfile: Error while groupfile compression"); + g_debug(MODULE"%s: Error while groupfile compression", __func__); break; } } @@ -314,7 +314,7 @@ void process_groupfile(const char *base_path, struct repomdData *groupfile, cw_close(cw_plain); if (readed == CW_ERR) { - g_debug(MODULE"process_groupfile: Error while groupfile compression"); + g_debug(MODULE"%s: Error while groupfile compression", __func__); } @@ -333,14 +333,14 @@ void process_groupfile(const char *base_path, struct repomdData *groupfile, struct stat gf_stat, cgf_stat; if (stat(path, &gf_stat)) { - g_debug(MODULE"process_groupfile: Error while stat() on %s", path); + g_debug(MODULE"%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"process_groupfile: Error while stat() on %s", path); + g_debug(MODULE"%s: Error while stat() on %s", __func__, path); } else { cgf_size = cgf_stat.st_size; cgf_time = cgf_stat.st_mtime; @@ -427,13 +427,13 @@ char *repomd_xml_dump(long revision, struct repomdData *pri_xml, struct repomdDa { xmlBufferPtr buf = xmlBufferCreate(); if (!buf) { - g_critical(MODULE"Error creating the xml buffer"); + g_critical(MODULE"%s: Error creating the xml buffer", __func__); return NULL; } xmlTextWriterPtr writer = xmlNewTextWriterMemory(buf, 0); if (writer == NULL) { - g_critical(MODULE"Error creating the xml writer"); + g_critical(MODULE"%s: Error creating the xml writer", __func__); return NULL; } @@ -444,13 +444,13 @@ char *repomd_xml_dump(long revision, struct repomdData *pri_xml, struct repomdDa rc = xmlTextWriterStartDocument(writer, NULL, "UTF-8", NULL); if (rc < 0) { - g_critical(MODULE"Error at xmlTextWriterStartDocument\n"); + g_critical(MODULE"%s: Error at xmlTextWriterStartDocument\n", __func__); return NULL; } rc = xmlTextWriterStartElement(writer, BAD_CAST "repomd"); if (rc < 0) { - g_critical(MODULE"Error at xmlTextWriterStartElement repomd\n"); + g_critical(MODULE"%s: Error at xmlTextWriterStartElement repomd\n", __func__); return NULL; } xmlTextWriterWriteAttribute(writer, BAD_CAST "xmlns:rpm", (xmlChar *) RPM_NS); @@ -458,7 +458,7 @@ char *repomd_xml_dump(long revision, struct repomdData *pri_xml, struct repomdDa rc = xmlTextWriterStartElement(writer, BAD_CAST "revision"); if (rc < 0) { - g_critical(MODULE"Error at xmlTextWriterStartElement revision\n"); + g_critical(MODULE"%s: Error at xmlTextWriterStartElement revision\n", __func__); return NULL; } @@ -521,7 +521,7 @@ void rename_file(const char *base_path, struct repomdData *md) // Rename if (g_file_test (new_path, G_FILE_TEST_EXISTS)) { if (remove(new_path)) { - g_critical(MODULE"rename_file: Cannot delete old %s", new_path); + g_critical(MODULE"%s: Cannot delete old %s", __func__, new_path); g_free(path); g_free(new_location_href); g_free(new_path); @@ -529,7 +529,7 @@ void rename_file(const char *base_path, struct repomdData *md) } } if (rename(path, new_path)) { - g_critical(MODULE"rename_file: Cannot rename %s to %s", path, new_path); + g_critical(MODULE"%s: Cannot rename %s to %s", __func__, path, new_path); g_free(path); g_free(new_location_href); g_free(new_path); diff --git a/src/xml_dump_filelists.c b/src/xml_dump_filelists.c index 65b44b6..7935b37 100644 --- a/src/xml_dump_filelists.c +++ b/src/xml_dump_filelists.c @@ -68,7 +68,7 @@ char *xml_dump_filelists(Package *package) char *result; xmlBufferPtr buf = xmlBufferCreate(); if (buf == NULL) { - g_critical(MODULE"xml_dump_filelists: Error creating the xml buffer"); + g_critical(MODULE"%s: Error creating the xml buffer", __func__); return NULL; } // Seems to be little bit faster than xmlDocDumpFormatMemory diff --git a/src/xml_dump_other.c b/src/xml_dump_other.c index 6d87837..f178b13 100644 --- a/src/xml_dump_other.c +++ b/src/xml_dump_other.c @@ -104,7 +104,7 @@ char *xml_dump_other(Package *package) char *result; xmlBufferPtr buf = xmlBufferCreate(); if (buf == NULL) { - g_critical(MODULE"xml_dump_other: Error creating the xml buffer"); + g_critical(MODULE"%s: Error creating the xml buffer", __func__); return NULL; } // Seems to be little bit faster than xmlDocDumpFormatMemory diff --git a/src/xml_dump_primary.c b/src/xml_dump_primary.c index e7d6ca2..ffe917f 100644 --- a/src/xml_dump_primary.c +++ b/src/xml_dump_primary.c @@ -24,7 +24,7 @@ void dump_pco(xmlNodePtr root, Package *package, int pcotype) { - const char *elem_name = NULL; + const char *elem_name; GSList *files = NULL; const char *provides = "rpm:provides"; @@ -335,7 +335,7 @@ char *xml_dump_primary(Package *package) char *result; xmlBufferPtr buf = xmlBufferCreate(); if (buf == NULL) { - g_critical(MODULE"xml_dump_other: Error creating the xml buffer"); + g_critical(MODULE"%s: Error creating the xml buffer", __func__); return NULL; } // Seems to be little bit faster than xmlDocDumpFormatMemory