Mark log callback format string const

Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Dan McGee 2011-02-24 09:38:59 -06:00
parent 6735807c0f
commit 7c14e48776
8 changed files with 10 additions and 10 deletions

View file

@ -74,8 +74,8 @@ typedef enum _pmloglevel_t {
PM_LOG_FUNCTION = (1 << 3) PM_LOG_FUNCTION = (1 << 3)
} pmloglevel_t; } pmloglevel_t;
typedef void (*alpm_cb_log)(pmloglevel_t, char *, va_list); typedef void (*alpm_cb_log)(pmloglevel_t, const char *, va_list);
int alpm_logaction(char *fmt, ...); int alpm_logaction(const char *fmt, ...);
/* /*
* Downloading * Downloading

View file

@ -42,7 +42,7 @@
* @param fmt output format * @param fmt output format
* @return 0 on success, -1 on error (pm_errno is set accordingly) * @return 0 on success, -1 on error (pm_errno is set accordingly)
*/ */
int SYMEXPORT alpm_logaction(char *fmt, ...) int SYMEXPORT alpm_logaction(const char *fmt, ...)
{ {
int ret; int ret;
va_list args; va_list args;
@ -88,7 +88,7 @@ int SYMEXPORT alpm_logaction(char *fmt, ...)
/** @} */ /** @} */
void _alpm_log(pmloglevel_t flag, char *fmt, ...) void _alpm_log(pmloglevel_t flag, const char *fmt, ...)
{ {
va_list args; va_list args;
alpm_cb_log logcb = alpm_option_get_logcb(); alpm_cb_log logcb = alpm_option_get_logcb();

View file

@ -29,7 +29,7 @@
#define ALPM_LOG_FUNC #define ALPM_LOG_FUNC
#endif #endif
void _alpm_log(pmloglevel_t flag, char *fmt, ...) __attribute__((format(printf,2,3))); void _alpm_log(pmloglevel_t flag, const char *fmt, ...) __attribute__((format(printf,2,3)));
#endif /* _ALPM_LOG_H */ #endif /* _ALPM_LOG_H */

View file

@ -669,7 +669,7 @@ void cb_dl_progress(const char *filename, off_t file_xfered, off_t file_total)
} }
/* Callback to handle notifications from the library */ /* Callback to handle notifications from the library */
void cb_log(pmloglevel_t level, char *fmt, va_list args) void cb_log(pmloglevel_t level, const char *fmt, va_list args)
{ {
if(!fmt || strlen(fmt) == 0) { if(!fmt || strlen(fmt) == 0) {
return; return;

View file

@ -41,7 +41,7 @@ void cb_dl_total(off_t total);
void cb_dl_progress(const char *filename, off_t file_xfered, off_t file_total); void cb_dl_progress(const char *filename, off_t file_xfered, off_t file_total);
/* callback to handle messages/notifications from pacman library */ /* callback to handle messages/notifications from pacman library */
void cb_log(pmloglevel_t level, char *fmt, va_list args); void cb_log(pmloglevel_t level, const char *fmt, va_list args);
#endif /* _PM_CALLBACK_H */ #endif /* _PM_CALLBACK_H */

View file

@ -37,7 +37,7 @@ static void cleanup(int signum) {
exit(signum); exit(signum);
} }
static void output_cb(pmloglevel_t level, char *fmt, va_list args) static void output_cb(pmloglevel_t level, const char *fmt, va_list args)
{ {
if(strlen(fmt)) { if(strlen(fmt)) {
switch(level) { switch(level) {

View file

@ -39,7 +39,7 @@ static void cleanup(int signum) {
exit(signum); exit(signum);
} }
static void output_cb(pmloglevel_t level, char *fmt, va_list args) static void output_cb(pmloglevel_t level, const char *fmt, va_list args)
{ {
if(strlen(fmt)) { if(strlen(fmt)) {
switch(level) { switch(level) {

View file

@ -24,7 +24,7 @@
#define BASENAME "testpkg" #define BASENAME "testpkg"
static void output_cb(pmloglevel_t level, char *fmt, va_list args) static void output_cb(pmloglevel_t level, const char *fmt, va_list args)
{ {
if(fmt[0] == '\0') { if(fmt[0] == '\0') {
return; return;