[Openais] [PATCH 8/9] flight recorder: don't hardcode max arguments everywhere

Fabio M. Di Nitto fdinitto at redhat.com
Wed Jun 17 22:35:29 PDT 2009


Committed revision 2251.


On Wed, 2009-06-17 at 12:53 +0200, Fabio M. Di Nitto wrote:
> Signed-off-by: Fabio M. Di Nitto <fdinitto at redhat.com>
> ---
> :100644 100644 77e8bd7... 90efdf8... M	exec/logsys.c
>  exec/logsys.c |   14 +++++++-------
>  1 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/exec/logsys.c b/exec/logsys.c
> index 77e8bd7..90efdf8 100644
> --- a/exec/logsys.c
> +++ b/exec/logsys.c
> @@ -189,6 +189,8 @@ void *logsys_rec_end;
>  
>  #define FDTAIL_INDEX 	(flt_data_size + 1)
>  
> +#define FDMAX_ARGS	64
> +
>  /* forward declarations */
>  static void logsys_close_logfile(int subsysid);
>  
> @@ -619,7 +621,7 @@ static void record_print (const char *buf)
>  	unsigned int i;
>  	unsigned int words_processed;
>  	unsigned int arg_size_idx;
> -	const void *arguments[64];
> +	const void *arguments[FDMAX_ARGS];
>  	unsigned int arg_count;
>  
>  	arg_size_idx = 4;
> @@ -1088,18 +1090,16 @@ void _logsys_log_rec (
>  	...)
>  {
>  	va_list ap;
> -	const void *buf_args[64];
> -	unsigned int buf_len[64];
> +	const void *buf_args[FDMAX_ARGS];
> +	unsigned int buf_len[FDMAX_ARGS];
>  	unsigned int i;
>  	unsigned int idx;
>  	unsigned int arguments = 0;
> -	unsigned int record_reclaim_size;
> +	unsigned int record_reclaim_size = 0;
>  	unsigned int index_start;
>  	int words_written;
>  	int subsysid;
>  
> -	record_reclaim_size = 0;
> -
>  	subsysid = LOGSYS_DECODE_SUBSYSID(rec_ident);
>  
>  	/*
> @@ -1115,7 +1115,7 @@ void _logsys_log_rec (
>  		buf_len[arguments] = va_arg (ap, int);
>  		record_reclaim_size += ((buf_len[arguments] + 3) >> 2) + 1;
>  		arguments++;
> -		if (arguments >= 64) {
> +		if (arguments >= FDMAX_ARGS) {
>  			break;
>  		}
>  	}



More information about the Openais mailing list