From e5465324dd11f8e9da33cf760e6166fdfe2e4304 Mon Sep 17 00:00:00 2001 From: Sergey Nikiforov Date: Sat, 14 Jan 2023 00:12:05 +0500 Subject: vppinfra: add const to char* params of several funcs These functions do not need modifiable strings. It helps with linker sections as well as C++ compatibility. It is a good style to use const where approriate. Type: refactor Signed-off-by: void234@gmail.com Change-Id: I8d1e922197b3594122296e8c1af57e0a8ec0bf3d --- src/vppinfra/error.c | 8 ++++---- src/vppinfra/error.h | 7 +++---- src/vppinfra/error_bootstrap.h | 5 ++--- 3 files changed, 9 insertions(+), 11 deletions(-) (limited to 'src/vppinfra') diff --git a/src/vppinfra/error.c b/src/vppinfra/error.c index b2b1a83e552..374b8b5256a 100644 --- a/src/vppinfra/error.c +++ b/src/vppinfra/error.c @@ -109,8 +109,8 @@ dispatch_message (u8 * msg) } __clib_export void -_clib_error (int how_to_die, - char *function_name, uword line_number, char *fmt, ...) +_clib_error (int how_to_die, const char *function_name, uword line_number, + const char *fmt, ...) { u8 *msg = 0; va_list va; @@ -146,8 +146,8 @@ _clib_error (int how_to_die, } __clib_export clib_error_t * -_clib_error_return (clib_error_t * errors, - any code, uword flags, char *where, char *fmt, ...) +_clib_error_return (clib_error_t *errors, any code, uword flags, + const char *where, const char *fmt, ...) { clib_error_t *e; va_list va; diff --git a/src/vppinfra/error.h b/src/vppinfra/error.h index e0e2d4726b2..9eae8ea6818 100644 --- a/src/vppinfra/error.h +++ b/src/vppinfra/error.h @@ -85,10 +85,9 @@ extern void *clib_error_free_vector (clib_error_t * errors); #define clib_error_free(e) e = clib_error_free_vector(e) -extern clib_error_t *_clib_error_return (clib_error_t * errors, - any code, - uword flags, - char *where, char *fmt, ...); +extern clib_error_t *_clib_error_return (clib_error_t *errors, any code, + uword flags, const char *where, + const char *fmt, ...); #define clib_error_return_code(e,code,flags,args...) \ _clib_error_return((e),(code),(flags),(char *)clib_error_function,args) diff --git a/src/vppinfra/error_bootstrap.h b/src/vppinfra/error_bootstrap.h index 185f4c6c4af..ae23d1bcca8 100644 --- a/src/vppinfra/error_bootstrap.h +++ b/src/vppinfra/error_bootstrap.h @@ -62,9 +62,8 @@ enum /* Low level error reporting function. Code specifies whether to call exit, abort or nothing at all (for non-fatal warnings). */ -extern void _clib_error (int code, - char *function_name, - uword line_number, char *format, ...); +extern void _clib_error (int code, const char *function_name, + uword line_number, const char *format, ...); #define ASSERT(truth) \ do { \ -- cgit 1.2.3-korg