From: Petr Machata Date: Mon, 2 Feb 2009 16:33:21 +0000 (+0100) Subject: const-correctify output and where formatting functions X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c7b75e48a102b3c1211501495170c9f88f40090a;p=thirdparty%2Felfutils.git const-correctify output and where formatting functions --- diff --git a/src/dwarflint.c b/src/dwarflint.c index 7c3f83e4d..f576fc3a5 100644 --- a/src/dwarflint.c +++ b/src/dwarflint.c @@ -125,7 +125,7 @@ check_category (enum message_category cat) } static void -wr_verror (struct where *wh, const char *format, va_list ap) +wr_verror (const struct where *wh, const char *format, va_list ap) { printf ("error: %s", where_fmt (wh, NULL)); vprintf (format, ap); @@ -134,7 +134,7 @@ wr_verror (struct where *wh, const char *format, va_list ap) } static void -wr_vwarning (struct where *wh, const char *format, va_list ap) +wr_vwarning (const struct where *wh, const char *format, va_list ap) { printf ("warning: %s", where_fmt (wh, NULL)); vprintf (format, ap); @@ -143,7 +143,7 @@ wr_vwarning (struct where *wh, const char *format, va_list ap) } void -wr_error (struct where *wh, const char *format, ...) +wr_error (const struct where *wh, const char *format, ...) { va_list ap; va_start (ap, format); @@ -152,7 +152,7 @@ wr_error (struct where *wh, const char *format, ...) } void -wr_warning (struct where *wh, const char *format, ...) +wr_warning (const struct where *wh, const char *format, ...) { va_list ap; va_start (ap, format); @@ -161,8 +161,8 @@ wr_warning (struct where *wh, const char *format, ...) } void -wr_message (enum message_category category, struct where *wh, - const char *format, ...) +wr_message (enum message_category category, const struct where *wh, + const char *format, ...) { va_list ap; va_start (ap, format); @@ -540,7 +540,7 @@ static bool check_pub_structural (struct read_ctx *ctx, const char * -where_fmt (struct where *wh, char *ptr) +where_fmt (const struct where *wh, char *ptr) { if (wh == NULL) return ""; @@ -647,7 +647,7 @@ where_fmt (struct where *wh, char *ptr) } void -where_fmt_chain (struct where *wh, const char *severity) +where_fmt_chain (const struct where *wh, const char *severity) { if (wh != NULL) for (struct where *it = wh->next; it != NULL; it = it->next) diff --git a/src/dwarflint.h b/src/dwarflint.h index ee1ced918..4e2a7ea93 100644 --- a/src/dwarflint.h +++ b/src/dwarflint.h @@ -45,8 +45,8 @@ extern "C" ((struct where) \ {(SECTION), (uint64_t)-1, (uint64_t)-1, (uint64_t)-1, NULL, NEXT}) - extern const char *where_fmt (struct where *wh, char *ptr); - extern void where_fmt_chain (struct where *wh, const char *severity); + extern const char *where_fmt (const struct where *wh, char *ptr); + extern void where_fmt_chain (const struct where *wh, const char *severity); extern void where_reset_1 (struct where *wh, uint64_t addr); extern void where_reset_2 (struct where *wh, uint64_t addr); extern void where_reset_3 (struct where *wh, uint64_t addr); @@ -93,13 +93,13 @@ extern "C" mc_all = 0xffffff00, // all areas }; - extern void wr_error (struct where *wh, const char *format, ...) + extern void wr_error (const struct where *wh, const char *format, ...) __attribute__ ((format (printf, 2, 3))); - extern void wr_warning (struct where *wh, const char *format, ...) + extern void wr_warning (const struct where *wh, const char *format, ...) __attribute__ ((format (printf, 2, 3))); - extern void wr_message (enum message_category category, struct where *wh, + extern void wr_message (enum message_category category, const struct where *wh, const char *format, ...) __attribute__ ((format (printf, 3, 4)));