diff options
author | Nikola Pajkovsky <npajkovs@redhat.com> | 2010-09-01 10:46:46 +0200 |
---|---|---|
committer | Nikola Pajkovsky <npajkovs@redhat.com> | 2010-09-02 16:43:07 +0200 |
commit | 4ea747db6085cb579f2e4b6616750d8c507a842d (patch) | |
tree | c22a4911c8fcde34ef54094a265f63ed3003f1ab /lib | |
parent | 5cb354fd18e2a06ffc55910ceb0c1d1f284bf1f7 (diff) | |
download | abrt-4ea747db6085cb579f2e4b6616750d8c507a842d.tar.gz abrt-4ea747db6085cb579f2e4b6616750d8c507a842d.tar.xz abrt-4ea747db6085cb579f2e4b6616750d8c507a842d.zip |
DebugDump.cpp: lowercase and rename functions
Signed-off-by: Nikola Pajkovsky <npajkovs@redhat.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/plugins/CCpp.cpp | 42 | ||||
-rw-r--r-- | lib/plugins/Kerneloops.cpp | 2 | ||||
-rw-r--r-- | lib/plugins/KerneloopsScanner.cpp | 12 | ||||
-rw-r--r-- | lib/plugins/Python.cpp | 2 | ||||
-rw-r--r-- | lib/plugins/RunApp.cpp | 2 | ||||
-rw-r--r-- | lib/utils/DebugDump.cpp | 58 |
6 files changed, 59 insertions, 59 deletions
diff --git a/lib/plugins/CCpp.cpp b/lib/plugins/CCpp.cpp index 7665cad3..c01b1953 100644 --- a/lib/plugins/CCpp.cpp +++ b/lib/plugins/CCpp.cpp @@ -194,8 +194,8 @@ static char *get_backtrace(const char *pDebugDumpDir, const char *pDebugInfoDirs return NULL; } - char *uid = dd_loadtxt(dd, CD_UID); - char *executable = dd_loadtxt(dd, FILENAME_EXECUTABLE); + char *uid = dd_load_text(dd, CD_UID); + char *executable = dd_load_text(dd, FILENAME_EXECUTABLE); dd_close(dd); // Workaround for @@ -343,7 +343,7 @@ static char* run_unstrip_n(const char *pDebugDumpDir) return NULL; } - char *uid = dd_loadtxt(dd, CD_UID); + char *uid = dd_load_text(dd, CD_UID); dd_close(dd); char* args[4]; @@ -537,8 +537,8 @@ string CAnalyzerCCpp::GetLocalUUID(const char *pDebugDumpDir) return string(""); } - char *executable = dd_loadtxt(dd, FILENAME_EXECUTABLE); - char *package = dd_loadtxt(dd, FILENAME_PACKAGE); + char *executable = dd_load_text(dd, FILENAME_EXECUTABLE); + char *package = dd_load_text(dd, FILENAME_PACKAGE); dd_close(dd); string independentBuildIdPC; @@ -599,7 +599,7 @@ string CAnalyzerCCpp::GetGlobalUUID(const char *pDebugDumpDir) if (dd_exist(dd, FILENAME_GLOBAL_UUID)) { - char *uuid = dd_loadtxt(dd, FILENAME_GLOBAL_UUID); + char *uuid = dd_load_text(dd, FILENAME_GLOBAL_UUID); dd_close(dd); string ret = uuid; free(uuid); @@ -612,9 +612,9 @@ string CAnalyzerCCpp::GetGlobalUUID(const char *pDebugDumpDir) log(_("Getting global universal unique identification...")); string backtrace_path = concat_path_file(pDebugDumpDir, FILENAME_BACKTRACE); - char *executable = dd_loadtxt(dd, FILENAME_EXECUTABLE); - char *package = dd_loadtxt(dd, FILENAME_PACKAGE); - char *uid_str = m_bBacktrace ? dd_loadtxt(dd, CD_UID) : xstrdup(""); + char *executable = dd_load_text(dd, FILENAME_EXECUTABLE); + char *package = dd_load_text(dd, FILENAME_PACKAGE); + char *uid_str = m_bBacktrace ? dd_load_text(dd, CD_UID) : xstrdup(""); string independent_backtrace; if (m_bBacktrace) @@ -712,7 +712,7 @@ string CAnalyzerCCpp::GetGlobalUUID(const char *pDebugDumpDir) */ else { - dd_savetxt(dd, FILENAME_RATING, "0"); + dd_save_text(dd, FILENAME_RATING, "0"); } dd_close(dd); @@ -770,7 +770,7 @@ void CAnalyzerCCpp::CreateReport(const char *pDebugDumpDir, int force) /* Skip remote crashes. */ if (dd_exist(dd, FILENAME_REMOTE)) { - char *remote_str = dd_loadtxt(dd, FILENAME_REMOTE); + char *remote_str = dd_load_text(dd, FILENAME_REMOTE); bool remote = (remote_str[0] != '1'); free(remote_str); if (remote && !m_bBacktraceRemotes) @@ -796,9 +796,9 @@ void CAnalyzerCCpp::CreateReport(const char *pDebugDumpDir, int force) } } - char *package = dd_loadtxt(dd, FILENAME_PACKAGE); - char *executable = dd_loadtxt(dd, FILENAME_EXECUTABLE); - char *uid = dd_loadtxt(dd, CD_UID); + char *package = dd_load_text(dd, FILENAME_PACKAGE); + char *executable = dd_load_text(dd, FILENAME_EXECUTABLE); + char *uid = dd_load_text(dd, CD_UID); dd_close(dd); /* do not keep dir locked longer than needed */ char *build_ids = NULL; @@ -829,11 +829,11 @@ void CAnalyzerCCpp::CreateReport(const char *pDebugDumpDir, int force) VERB1 log(_("Unable to open debug dump '%s'"), pDebugDumpDir); return; } - dd_savetxt(dd, FILENAME_BACKTRACE, bt_build_ids); + dd_save_text(dd, FILENAME_BACKTRACE, bt_build_ids); free(bt_build_ids); if (m_bMemoryMap) - dd_savetxt(dd, FILENAME_MEMORYMAP, "memory map of the crashed C/C++ application, not implemented yet"); + dd_save_text(dd, FILENAME_MEMORYMAP, "memory map of the crashed C/C++ application, not implemented yet"); /* Compute and store UUID from the backtrace. */ char *backtrace_cpy = xstrdup(backtrace_str); @@ -870,7 +870,7 @@ void CAnalyzerCCpp::CreateReport(const char *pDebugDumpDir, int force) struct strbuf *bt = backtrace_tree_as_str(backtrace, false); strbuf_prepend_str(bt, executable); strbuf_prepend_str(bt, package); - dd_savetxt(dd, FILENAME_GLOBAL_UUID, create_hash(bt->buf).c_str()); + dd_save_text(dd, FILENAME_GLOBAL_UUID, create_hash(bt->buf).c_str()); strbuf_free(bt); /* Compute and store backtrace rating. */ @@ -886,7 +886,7 @@ void CAnalyzerCCpp::CreateReport(const char *pDebugDumpDir, int force) else if (qtot < 0.8f) rating = "2"; else if (qtot < 0.9f) rating = "3"; else rating = "4"; - dd_savetxt(dd, FILENAME_RATING, rating); + dd_save_text(dd, FILENAME_RATING, rating); /* Get the function name from the crash frame. */ if (crash_thread) @@ -896,7 +896,7 @@ void CAnalyzerCCpp::CreateReport(const char *pDebugDumpDir, int force) if (abort_frame) crash_frame = abort_frame->next; if (crash_frame && crash_frame->function && 0 != strcmp(crash_frame->function, "??")) - dd_savetxt(dd, FILENAME_CRASH_FUNCTION, crash_frame->function); + dd_save_text(dd, FILENAME_CRASH_FUNCTION, crash_frame->function); } backtrace_free(backtrace); @@ -910,12 +910,12 @@ void CAnalyzerCCpp::CreateReport(const char *pDebugDumpDir, int force) struct strbuf *ibt = independent_backtrace(backtrace_str); strbuf_prepend_str(ibt, executable); strbuf_prepend_str(ibt, package); - dd_savetxt(dd, FILENAME_GLOBAL_UUID, create_hash(ibt->buf).c_str()); + dd_save_text(dd, FILENAME_GLOBAL_UUID, create_hash(ibt->buf).c_str()); strbuf_free(ibt); /* Compute and store backtrace rating. */ /* Crash frame is not known so store nothing. */ - dd_savetxt(dd, FILENAME_RATING, to_string(backtrace_rate_old(backtrace_str)).c_str()); + dd_save_text(dd, FILENAME_RATING, to_string(backtrace_rate_old(backtrace_str)).c_str()); } free(executable); free(package); diff --git a/lib/plugins/Kerneloops.cpp b/lib/plugins/Kerneloops.cpp index 913b20ef..1b58cd1b 100644 --- a/lib/plugins/Kerneloops.cpp +++ b/lib/plugins/Kerneloops.cpp @@ -134,7 +134,7 @@ std::string CAnalyzerKerneloops::GetLocalUUID(const char *pDebugDumpDir) return std::string(""); } - char *oops = dd_loadtxt(dd, FILENAME_BACKTRACE); + char *oops = dd_load_text(dd, FILENAME_BACKTRACE); unsigned hash = hash_oops_str(oops); free(oops); diff --git a/lib/plugins/KerneloopsScanner.cpp b/lib/plugins/KerneloopsScanner.cpp index 1621b04d..2a1bc47a 100644 --- a/lib/plugins/KerneloopsScanner.cpp +++ b/lib/plugins/KerneloopsScanner.cpp @@ -136,14 +136,14 @@ int save_oops_to_debug_dump(const vector_string_t& oopsList) dump_dir_t *dd = dd_init(); if (dd_create(dd, path, /*uid:*/ 0)) { - dd_savetxt(dd, FILENAME_ANALYZER, "Kerneloops"); - dd_savetxt(dd, FILENAME_EXECUTABLE, "kernel"); - dd_savetxt(dd, FILENAME_KERNEL, first_line); - dd_savetxt(dd, FILENAME_CMDLINE, "not_applicable"); - dd_savetxt(dd, FILENAME_BACKTRACE, second_line); + dd_save_text(dd, FILENAME_ANALYZER, "Kerneloops"); + dd_save_text(dd, FILENAME_EXECUTABLE, "kernel"); + dd_save_text(dd, FILENAME_KERNEL, first_line); + dd_save_text(dd, FILENAME_CMDLINE, "not_applicable"); + dd_save_text(dd, FILENAME_BACKTRACE, second_line); /* Optional, makes generated bz more informative */ strchrnul(second_line, '\n')[0] = '\0'; - dd_savetxt(dd, FILENAME_REASON, second_line); + dd_save_text(dd, FILENAME_REASON, second_line); dd_close(dd); } else diff --git a/lib/plugins/Python.cpp b/lib/plugins/Python.cpp index d634e0c5..96ba03e9 100644 --- a/lib/plugins/Python.cpp +++ b/lib/plugins/Python.cpp @@ -34,7 +34,7 @@ string CAnalyzerPython::GetLocalUUID(const char *pDebugDumpDir) return string(""); } - char *bt = dd_loadtxt(dd, FILENAME_BACKTRACE); + char *bt = dd_load_text(dd, FILENAME_BACKTRACE); dd_close(dd); const char *bt_end = strchrnul(bt, '\n'); diff --git a/lib/plugins/RunApp.cpp b/lib/plugins/RunApp.cpp index f5833565..2f9d1285 100644 --- a/lib/plugins/RunApp.cpp +++ b/lib/plugins/RunApp.cpp @@ -66,7 +66,7 @@ void CActionRunApp::Run(const char *pActionDir, const char *pArgs, int force) return; } - dd_savebin(dd, args[FILENAME].c_str(), cmd_out, cmd_out_size); + dd_save_binary(dd, args[FILENAME].c_str(), cmd_out, cmd_out_size); dd_close(dd); } diff --git a/lib/utils/DebugDump.cpp b/lib/utils/DebugDump.cpp index 8987b432..cda1f988 100644 --- a/lib/utils/DebugDump.cpp +++ b/lib/utils/DebugDump.cpp @@ -34,7 +34,7 @@ static bool isdigit_str(const char *str) return true; } -static char* RemoveBackSlashes(const char *pDir) +static char* rm_trailing_slashes(const char *pDir) { unsigned len = strlen(pDir); while (len != 0 && pDir[len-1] == '/') @@ -42,7 +42,7 @@ static char* RemoveBackSlashes(const char *pDir) return xstrndup(pDir, len); } -static bool ExistFileDir(const char *pPath) +static bool exist_file_dir(const char *pPath) { struct stat buf; if (stat(pPath, &buf) == 0) @@ -55,7 +55,7 @@ static bool ExistFileDir(const char *pPath) return false; } -static char *LoadTextFile(const char *path); +static char *load_text_file(const char *path); static void dd_lock(dump_dir_t *dd); static void dd_unlock(dump_dir_t *dd); @@ -85,8 +85,8 @@ int dd_opendir(dump_dir_t *dd, const char *dir) if (dd->opened) error_msg_and_die("CDebugDump is already opened"); - dd->dd_dir = RemoveBackSlashes(dir); - if (!dd->dd_dir || !ExistFileDir(dd->dd_dir)) + dd->dd_dir = rm_trailing_slashes(dir); + if (!dd->dd_dir || !exist_file_dir(dd->dd_dir)) { error_msg("'%s' does not exist", dd->dd_dir); return 0; @@ -109,12 +109,12 @@ int dd_opendir(dump_dir_t *dd, const char *dir) int dd_exist(dump_dir_t *dd, const char *path) { char *full_path = concat_path_file(dd->dd_dir, path); - int ret = ExistFileDir(full_path); + int ret = exist_file_dir(full_path); free(full_path); return ret; } -static bool GetAndSetLock(const char* pLockFile, const char* pPID) +static bool get_and_set_lock(const char* pLockFile, const char* pPID) { while (symlink(pPID, pLockFile) != 0) { @@ -232,7 +232,7 @@ static void dd_lock(dump_dir_t *dd) char pid_buf[sizeof(long)*3 + 2]; sprintf(pid_buf, "%lu", (long)getpid()); - while ((dd->locked = GetAndSetLock(lock_buf, pid_buf)) != true) + while ((dd->locked = get_and_set_lock(lock_buf, pid_buf)) != true) { sleep(1); /* was 0.5 seconds */ } @@ -273,8 +273,8 @@ int dd_create(dump_dir_t *dd, const char *dir, uid_t uid) if (dd->opened) error_msg_and_die("DebugDump is already opened"); - dd->dd_dir = RemoveBackSlashes(dir); - if (ExistFileDir(dd->dd_dir)) + dd->dd_dir = rm_trailing_slashes(dir); + if (exist_file_dir(dd->dd_dir)) { error_msg("'%s' already exists", dd->dd_dir); return 0; @@ -328,7 +328,7 @@ int dd_create(dump_dir_t *dd, const char *dir, uid_t uid) char uid_str[sizeof(long) * 3 + 2]; sprintf(uid_str, "%lu", (long)uid); - dd_savetxt(dd, CD_UID, uid_str); + dd_save_text(dd, CD_UID, uid_str); { struct utsname buf; @@ -336,25 +336,25 @@ int dd_create(dump_dir_t *dd, const char *dir, uid_t uid) { perror_msg_and_die("uname"); } - dd_savetxt(dd, FILENAME_KERNEL, buf.release); - dd_savetxt(dd, FILENAME_ARCHITECTURE, buf.machine); - char *release = LoadTextFile("/etc/redhat-release"); + dd_save_text(dd, FILENAME_KERNEL, buf.release); + dd_save_text(dd, FILENAME_ARCHITECTURE, buf.machine); + char *release = load_text_file("/etc/redhat-release"); strchrnul(release, '\n')[0] = '\0'; - dd_savetxt(dd, FILENAME_RELEASE, release); + dd_save_text(dd, FILENAME_RELEASE, release); free(release); } time_t t = time(NULL); char t_str[sizeof(time_t) * 3 + 2]; sprintf(t_str, "%lu", (time_t)t); - dd_savetxt(dd, FILENAME_TIME, t_str); + dd_save_text(dd, FILENAME_TIME, t_str); return 1; } -static bool DeleteFileDir(const char *pDir) +static bool delete_file_dir(const char *pDir) { - if (!ExistFileDir(pDir)) + if (!exist_file_dir(pDir)) return true; DIR *d = opendir(pDir); @@ -379,7 +379,7 @@ static bool DeleteFileDir(const char *pDir) free(full_path); return false; } - DeleteFileDir(full_path); + delete_file_dir(full_path); } free(full_path); } @@ -395,15 +395,15 @@ static bool DeleteFileDir(const char *pDir) void dd_delete(dump_dir_t *dd) { - if (!ExistFileDir(dd->dd_dir)) + if (!exist_file_dir(dd->dd_dir)) { return; } - DeleteFileDir(dd->dd_dir); + delete_file_dir(dd->dd_dir); } -static char *LoadTextFile(const char *pPath) +static char *load_text_file(const char *pPath) { FILE *fp = fopen(pPath, "r"); if (!fp) @@ -426,7 +426,7 @@ static char *LoadTextFile(const char *pPath) return strbuf_free_nobuf(buf_content); } -static bool SaveBinaryFile(const char *pPath, const char* pData, unsigned size, uid_t uid, gid_t gid) +static bool save_binary_file(const char *pPath, const char* pData, unsigned size, uid_t uid, gid_t gid) { /* "Why 0640?!" See ::Create() for security analysis */ unlink(pPath); @@ -451,35 +451,35 @@ static bool SaveBinaryFile(const char *pPath, const char* pData, unsigned size, return true; } -char* dd_loadtxt(const dump_dir_t *dd, const char *name) +char* dd_load_text(const dump_dir_t *dd, const char *name) { if (!dd->opened) error_msg_and_die("DebugDump is not opened"); char *full_path = concat_path_file(dd->dd_dir, name); - char *ret = LoadTextFile(full_path); + char *ret = load_text_file(full_path); free(full_path); return ret; } -void dd_savetxt(dump_dir_t *dd, const char *name, const char *data) +void dd_save_text(dump_dir_t *dd, const char *name, const char *data) { if (!dd->opened) error_msg_and_die("DebugDump is not opened"); char *full_path = concat_path_file(dd->dd_dir, name); - SaveBinaryFile(full_path, data, strlen(data), dd->uid, dd->gid); + save_binary_file(full_path, data, strlen(data), dd->uid, dd->gid); free(full_path); } -void dd_savebin(dump_dir_t* dd, const char* name, const char* data, unsigned size) +void dd_save_binary(dump_dir_t* dd, const char* name, const char* data, unsigned size) { if (dd->opened) error_msg_and_die("DebugDump is not opened"); char *full_path = concat_path_file(dd->dd_dir, name); - SaveBinaryFile(full_path, data, size, dd->uid, dd->gid); + save_binary_file(full_path, data, size, dd->uid, dd->gid); free(full_path); } |