Merge pull request #2231 from jsorg71/va_arg

va_list parameter passing change
This commit is contained in:
jsorg71 2022-04-18 11:53:32 -07:00 committed by GitHub
commit fd3f81e720
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 35 deletions

View File

@ -280,7 +280,7 @@ not_enough_input_msg = "Input buffer overflow for '%c'";
* The value must be a 0 or 1 on-the-wire, or an error is returned.
*/
static enum libipm_status
extract_bool_type(char c, struct trans *trans, va_list argptr)
extract_bool_type(char c, struct trans *trans, va_list *argptr)
{
enum libipm_status rv = E_LI_SUCCESS;
struct stream *s = trans->in_s;
@ -301,7 +301,7 @@ extract_bool_type(char c, struct trans *trans, va_list argptr)
}
else
{
int *tmp = va_arg(argptr, int *);
int *tmp = va_arg(*argptr, int *);
*tmp = b;
}
}
@ -317,7 +317,7 @@ extract_bool_type(char c, struct trans *trans, va_list argptr)
* @return != 0 for error
*/
static enum libipm_status
extract_int8_type(char c, struct trans *trans, va_list argptr)
extract_int8_type(char c, struct trans *trans, va_list *argptr)
{
enum libipm_status rv = E_LI_SUCCESS;
struct stream *s = trans->in_s;
@ -329,7 +329,7 @@ extract_int8_type(char c, struct trans *trans, va_list argptr)
}
else
{
unsigned char *tmp = va_arg(argptr, unsigned char *);
unsigned char *tmp = va_arg(*argptr, unsigned char *);
in_uint8(s, *tmp);
}
return rv;
@ -345,7 +345,7 @@ extract_int8_type(char c, struct trans *trans, va_list argptr)
* @return != 0 for error
*/
static enum libipm_status
extract_int16_type(char c, struct trans *trans, va_list argptr)
extract_int16_type(char c, struct trans *trans, va_list *argptr)
{
enum libipm_status rv = E_LI_SUCCESS;
struct stream *s = trans->in_s;
@ -357,7 +357,7 @@ extract_int16_type(char c, struct trans *trans, va_list argptr)
}
else
{
uint16_t *tmp = va_arg(argptr, uint16_t *);
uint16_t *tmp = va_arg(*argptr, uint16_t *);
/*
* C99 7.18.1.1 requires int16_t (if present) to be a two's
* complement representation, so this line is valid for both
@ -376,7 +376,7 @@ extract_int16_type(char c, struct trans *trans, va_list argptr)
* @return != 0 for error
*/
static enum libipm_status
extract_int32_type(char c, struct trans *trans, va_list argptr)
extract_int32_type(char c, struct trans *trans, va_list *argptr)
{
enum libipm_status rv = E_LI_SUCCESS;
struct stream *s = trans->in_s;
@ -388,7 +388,7 @@ extract_int32_type(char c, struct trans *trans, va_list argptr)
}
else
{
uint32_t *tmp = va_arg(argptr, uint32_t *);
uint32_t *tmp = va_arg(*argptr, uint32_t *);
/*
* C99 7.18.1.1 requires int32_t (if present) to be a two's
* complement representation, so this line is valid for both
@ -407,7 +407,7 @@ extract_int32_type(char c, struct trans *trans, va_list argptr)
* @return != 0 for error
*/
static enum libipm_status
extract_int64_type(char c, struct trans *trans, va_list argptr)
extract_int64_type(char c, struct trans *trans, va_list *argptr)
{
enum libipm_status rv = E_LI_SUCCESS;
struct stream *s = trans->in_s;
@ -419,7 +419,7 @@ extract_int64_type(char c, struct trans *trans, va_list argptr)
}
else
{
uint64_t *tmp = va_arg(argptr, uint64_t *);
uint64_t *tmp = va_arg(*argptr, uint64_t *);
/*
* C99 7.18.1.1 requires int64_t (if present) to be a two's
* complement representation, so this line is valid for both
@ -438,7 +438,7 @@ extract_int64_type(char c, struct trans *trans, va_list argptr)
* @return != 0 for error
*/
static enum libipm_status
extract_char_ptr_type(char c, struct trans *trans, va_list argptr)
extract_char_ptr_type(char c, struct trans *trans, va_list *argptr)
{
enum libipm_status rv = E_LI_SUCCESS;
struct stream *s = trans->in_s;
@ -453,7 +453,7 @@ extract_char_ptr_type(char c, struct trans *trans, va_list argptr)
}
else
{
char **tmp = va_arg(argptr, char **);
char **tmp = va_arg(*argptr, char **);
*tmp = s->p;
s->p = termptr + 1;
@ -470,11 +470,11 @@ extract_char_ptr_type(char c, struct trans *trans, va_list argptr)
* @return != 0 for error
*/
static enum libipm_status
extract_fsb_type(char c, struct trans *trans, va_list argptr)
extract_fsb_type(char c, struct trans *trans, va_list *argptr)
{
enum libipm_status rv = E_LI_SUCCESS;
struct stream *s = trans->in_s;
const struct libipm_fsb *fsb = va_arg(argptr, const struct libipm_fsb *);
const struct libipm_fsb *fsb = va_arg(*argptr, const struct libipm_fsb *);
if (fsb == NULL || fsb->data == NULL)
{
@ -521,7 +521,7 @@ extract_fsb_type(char c, struct trans *trans, va_list argptr)
* @return != 0 for error
*/
static enum libipm_status
libipm_msg_in_parsev(struct trans *trans, const char *format, va_list argptr)
libipm_msg_in_parsev(struct trans *trans, const char *format, va_list *argptr)
{
enum libipm_status rv = E_LI_SUCCESS;
struct stream *s = trans->in_s;
@ -623,7 +623,7 @@ libipm_msg_in_parse(struct trans *trans, const char *format, ...)
va_list argptr;
va_start(argptr, format);
rv = libipm_msg_in_parsev(trans, format, argptr);
rv = libipm_msg_in_parsev(trans, format, &argptr);
va_end(argptr);
}

View File

@ -94,7 +94,7 @@ bad_value_msg = "Type '%c' has unsupported value '%d'";
* The boolean value must be a 0 or a 1.
*/
static enum libipm_status
append_bool_type(char c, va_list argptr, struct trans *trans)
append_bool_type(char c, va_list *argptr, struct trans *trans)
{
enum libipm_status rv = E_LI_SUCCESS;
struct stream *s = trans->out_s;
@ -105,7 +105,7 @@ append_bool_type(char c, va_list argptr, struct trans *trans)
}
else
{
int tmp = va_arg(argptr, int);
int tmp = va_arg(*argptr, int);
if (tmp < 0 || tmp > 1)
{
log_append_error(trans, bad_value_msg, c, tmp);
@ -129,7 +129,7 @@ append_bool_type(char c, va_list argptr, struct trans *trans)
* @return != 0 for error
*/
static enum libipm_status
append_int8_type(char c, va_list argptr, struct trans *trans)
append_int8_type(char c, va_list *argptr, struct trans *trans)
{
enum libipm_status rv = E_LI_SUCCESS;
struct stream *s = trans->out_s;
@ -140,7 +140,7 @@ append_int8_type(char c, va_list argptr, struct trans *trans)
}
else
{
int tmp = va_arg(argptr, int);
int tmp = va_arg(*argptr, int);
if (tmp < 0 || tmp > 255)
{
log_append_error(trans, bad_value_msg, c, tmp);
@ -164,7 +164,7 @@ append_int8_type(char c, va_list argptr, struct trans *trans)
* @return != 0 for error
*/
static enum libipm_status
append_int16_type(char c, va_list argptr, struct trans *trans)
append_int16_type(char c, va_list *argptr, struct trans *trans)
{
enum libipm_status rv = E_LI_SUCCESS;
struct stream *s = trans->out_s;
@ -175,7 +175,7 @@ append_int16_type(char c, va_list argptr, struct trans *trans)
}
else
{
int tmp = va_arg(argptr, int);
int tmp = va_arg(*argptr, int);
if ((c == 'n' && (tmp < -0x8000 || tmp > 0x7fff)) ||
(c == 'q' && (tmp < 0 || tmp > 0xffff)))
{
@ -200,7 +200,7 @@ append_int16_type(char c, va_list argptr, struct trans *trans)
* @return != 0 for error
*/
static enum libipm_status
append_int32_type(char c, va_list argptr, struct trans *trans)
append_int32_type(char c, va_list *argptr, struct trans *trans)
{
enum libipm_status rv = E_LI_SUCCESS;
struct stream *s = trans->out_s;
@ -216,7 +216,7 @@ append_int32_type(char c, va_list argptr, struct trans *trans)
* and we will need to check the specified value is in range.
*/
#if SIZEOF_INT > 4
int tmp = va_arg(argptr, int);
int tmp = va_arg(*argptr, int);
if ((c == 'i' && (tmp < -0x80000000 || tmp > 0x7fffffff)) ||
(c == 'u' && (tmp < 0 || tmp > 0xffffffff)))
{
@ -229,7 +229,7 @@ append_int32_type(char c, va_list argptr, struct trans *trans)
out_uint32_le(s, tmp);
}
#else
uint32_t tmp = va_arg(argptr, uint32_t);
uint32_t tmp = va_arg(*argptr, uint32_t);
out_uint8(s, c);
out_uint32_le(s, tmp);
#endif
@ -246,7 +246,7 @@ append_int32_type(char c, va_list argptr, struct trans *trans)
* @return != 0 for error
*/
static enum libipm_status
append_int64_type(char c, va_list argptr, struct trans *trans)
append_int64_type(char c, va_list *argptr, struct trans *trans)
{
enum libipm_status rv = E_LI_SUCCESS;
struct stream *s = trans->out_s;
@ -257,7 +257,7 @@ append_int64_type(char c, va_list argptr, struct trans *trans)
}
else
{
uint64_t tmp = va_arg(argptr, uint64_t);
uint64_t tmp = va_arg(*argptr, uint64_t);
out_uint8(s, c);
out_uint64_le(s, tmp);
}
@ -275,11 +275,11 @@ append_int64_type(char c, va_list argptr, struct trans *trans)
* NULL pointers are not allowed for the string.
*/
static enum libipm_status
append_char_ptr_type(char c, va_list argptr, struct trans *trans)
append_char_ptr_type(char c, va_list *argptr, struct trans *trans)
{
enum libipm_status rv = E_LI_SUCCESS;
struct stream *s = trans->out_s;
const char *str = va_arg(argptr, const char *);
const char *str = va_arg(*argptr, const char *);
if (str == NULL)
{
log_append_error(trans, "String cannot be NULL");
@ -315,11 +315,11 @@ append_char_ptr_type(char c, va_list argptr, struct trans *trans)
* @return != 0 for error
*/
static enum libipm_status
append_fsb_type(char c, va_list argptr, struct trans *trans)
append_fsb_type(char c, va_list *argptr, struct trans *trans)
{
enum libipm_status rv = E_LI_SUCCESS;
struct stream *s = trans->out_s;
const struct libipm_fsb *fsb = va_arg(argptr, const struct libipm_fsb *);
const struct libipm_fsb *fsb = va_arg(*argptr, const struct libipm_fsb *);
if (fsb == NULL || fsb->data == NULL)
{
log_append_error(trans, "Malformed descriptor for '%c'", c);
@ -356,7 +356,7 @@ append_fsb_type(char c, va_list argptr, struct trans *trans)
* @return != 0 for error
*/
static enum libipm_status
libipm_msg_out_appendv(struct trans *trans, const char *format, va_list argptr)
libipm_msg_out_appendv(struct trans *trans, const char *format, va_list *argptr)
{
enum libipm_status rv = E_LI_SUCCESS;
struct libipm_priv *priv = (struct libipm_priv *)trans->extra_data;
@ -463,7 +463,7 @@ libipm_msg_out_init(struct trans *trans, unsigned short msgno,
init_output_buffer(trans, msgno);
va_start(argptr, format);
rv = libipm_msg_out_appendv(trans, format, argptr);
rv = libipm_msg_out_appendv(trans, format, &argptr);
va_end(argptr);
}
@ -487,7 +487,7 @@ libipm_msg_out_append(struct trans *trans, const char *format, ...)
va_list argptr;
va_start(argptr, format);
rv = libipm_msg_out_appendv(trans, format, argptr);
rv = libipm_msg_out_appendv(trans, format, &argptr);
va_end(argptr);
}
@ -542,7 +542,7 @@ libipm_msg_out_simple_send(struct trans *trans, unsigned short msgno,
va_start(argptr, format);
init_output_buffer(trans, msgno);
rv = libipm_msg_out_appendv(trans, format, argptr);
rv = libipm_msg_out_appendv(trans, format, &argptr);
if (rv == E_LI_SUCCESS)
{
libipm_msg_out_mark_end(trans);