[PATCH 09/11] lib: fwts_log: constify function arguments where appropriate

IvanHu ivan.hu at canonical.com
Mon Oct 22 09:33:48 UTC 2012


On 10/17/2012 03:20 AM, Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
>
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
>   src/lib/include/fwts_log.h |    4 ++--
>   src/lib/src/fwts_log.c     |   12 ++++++------
>   2 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/src/lib/include/fwts_log.h b/src/lib/include/fwts_log.h
> index 35f2801..5406897 100644
> --- a/src/lib/include/fwts_log.h
> +++ b/src/lib/include/fwts_log.h
> @@ -121,7 +121,7 @@ extern fwts_log_ops fwts_log_html_ops;
>   extern fwts_log_field fwts_log_filter;
>   extern const char *fwts_log_format;
>
> -fwts_log *fwts_log_open(const char* owner, const char *name, const char *mode, fwts_log_type);
> +fwts_log *fwts_log_open(const char* owner, const char *name, const char *mode, const fwts_log_type);
>   int       fwts_log_close(fwts_log *log);
>   int       fwts_log_printf(fwts_log *log, const fwts_log_field field, const fwts_log_level level, const char *status, const char *label, const char *prefix, const char *fmt, ...)
>   	__attribute__((format(printf, 7, 8)));
> @@ -143,7 +143,7 @@ char	 *fwts_log_field_to_str_upper(const fwts_log_field field);
>   void	  fwts_log_set_line_width(const int width);
>   void	  fwts_log_section_begin(fwts_log *log, const char *name);
>   void	  fwts_log_section_end(fwts_log *log);
> -char     *fwts_log_get_filenames(const char *filename, fwts_log_type type);
> +char     *fwts_log_get_filenames(const char *filename, const fwts_log_type type);
>   fwts_log_filename_type fwts_log_get_filename_type(const char *name);
>
>   static inline int fwts_log_type_count(fwts_log_type type)
> diff --git a/src/lib/src/fwts_log.c b/src/lib/src/fwts_log.c
> index 6ed32c1..63983d5 100644
> --- a/src/lib/src/fwts_log.c
> +++ b/src/lib/src/fwts_log.c
> @@ -43,7 +43,7 @@ const char *fwts_log_format = "";
>    *  fwts_log_set_line_width()
>    * 	set width of a log
>    */
> -void fwts_log_set_line_width(int width)
> +void fwts_log_set_line_width(const int width)
>   {
>   	if ((width >= 80) && (width <= 1024))
>   		log_line_width = width;
> @@ -310,7 +310,7 @@ void fwts_log_set_format(const char *str)
>    *  fwts_log_type_filename_suffix()
>    *	return a filename suffix on a given log type
>    */
> -static char *fwts_log_type_filename_suffix(fwts_log_type type)
> +static char *fwts_log_type_filename_suffix(const fwts_log_type type)
>   {
>   	switch (type) {
>   	case LOG_TYPE_JSON:
> @@ -330,7 +330,7 @@ static char *fwts_log_type_filename_suffix(fwts_log_type type)
>    *  fwts_log_filename_new_suffix()
>    *	return the log name with suffix based on log type
>    */
> -static char *fwts_log_filename(const char *filename, fwts_log_type type)
> +static char *fwts_log_filename(const char *filename, const fwts_log_type type)
>   {
>   	char *ptr;
>   	char *new_name;
> @@ -534,7 +534,7 @@ void fwts_log_section_end(fwts_log *log)
>    *  fwts_log_get_ops()
>    *	return log ops basedon log type
>    */
> -static fwts_log_ops *fwts_log_get_ops(fwts_log_type type)
> +static fwts_log_ops *fwts_log_get_ops(const fwts_log_type type)
>   {
>   	switch (type) {
>   	case LOG_TYPE_JSON:
> @@ -569,7 +569,7 @@ fwts_log_filename_type fwts_log_get_filename_type(const char *filename)
>    *  fwts_log_filenames()
>    *	return string of all the log filenames that will be used
>    */
> -char *fwts_log_get_filenames(const char *filename, fwts_log_type type)
> +char *fwts_log_get_filenames(const char *filename, const fwts_log_type type)
>   {
>   	unsigned int i;
>   	char *filenames = NULL;
> @@ -614,7 +614,7 @@ fwts_log *fwts_log_open(
>   	const char *owner,	/* Creator of the log */
>   	const char *filename,	/* Log file name */
>   	const char *mode,	/* open mode, see fopen() modes */
> -	fwts_log_type type)	/* Log type */
> +	const fwts_log_type type) /* Log type */
>   {
>   	fwts_log *newlog;
>   	unsigned int i;
>

Acked-by: Ivan Hu <ivan.hu at canonical.com>




More information about the fwts-devel mailing list