diff options
author | Cy Schubert <cy@FreeBSD.org> | 2023-11-14 23:02:42 +0000 |
---|---|---|
committer | Cy Schubert <cy@FreeBSD.org> | 2023-11-14 23:02:42 +0000 |
commit | 5223d1d95fddcef6f9a36e264a5800bd907ade8b (patch) | |
tree | 818b1eba912c588e39058586485699385c3179fe /test/regress.gen.c | |
parent | cbc620a473ce23d882ba3e9f91ec0c6c12dcd239 (diff) |
Diffstat (limited to 'test/regress.gen.c')
-rw-r--r-- | test/regress.gen.c | 105 |
1 files changed, 49 insertions, 56 deletions
diff --git a/test/regress.gen.c b/test/regress.gen.c index da994a51cb6e..611ec8af6714 100644 --- a/test/regress.gen.c +++ b/test/regress.gen.c @@ -1,5 +1,6 @@ + /* - * Automatically generated from ./test/regress.rpc + * Automatically generated from ../test/regress.rpc * by event_rpcgen.py/0.1. DO NOT EDIT THIS FILE. */ @@ -11,8 +12,14 @@ #include <event2/buffer.h> #include <event2/tag.h> -#if defined(EVENT____func__) && !defined(__func__) -#define __func__ EVENT____func__ +#if defined(EVENT__HAVE___func__) +# ifndef __func__ +# define __func__ __func__ +# endif +#elif defined(EVENT__HAVE___FUNCTION__) +# define __func__ __FUNCTION__ +#else +# define __func__ __FILE__ #endif @@ -21,7 +28,6 @@ void event_warn(const char *fmt, ...); void event_warnx(const char *fmt, ...); - /* * Implementation of msg */ @@ -86,7 +92,8 @@ msg_run_expand_to_hold_more(struct msg *msg) return -1; msg->run_data = new_data; msg->run_num_allocated = tobe_allocated; - return 0;} + return 0; +} struct run* msg_run_add(struct msg *msg) @@ -168,7 +175,7 @@ msg_attack_assign(struct msg *msg, int msg_run_assign(struct msg *msg, int off, - const struct run* value) + const struct run* value) { if (!msg->run_set || off < 0 || off >= msg->run_length) return (-1); @@ -188,7 +195,8 @@ msg_run_assign(struct msg *msg, int off, had_error = 1; goto done; } - done:if (tmp != NULL) + done: + if (tmp != NULL) evbuffer_free(tmp); if (had_error) { run_clear(msg->run_data[off]); @@ -295,7 +303,7 @@ msg_free(struct msg *tmp) } void -msg_marshal(struct evbuffer *evbuf, const struct msg *tmp){ +msg_marshal(struct evbuffer *evbuf, const struct msg *tmp) { evtag_marshal_string(evbuf, MSG_FROM_NAME, tmp->from_name_data); evtag_marshal_string(evbuf, MSG_TO_NAME, tmp->to_name_data); if (tmp->attack_set) { @@ -312,7 +320,7 @@ msg_marshal(struct evbuffer *evbuf, const struct msg *tmp){ } int -msg_unmarshal(struct msg *tmp, struct evbuffer *evbuf) +msg_unmarshal(struct msg *tmp, struct evbuffer *evbuf) { ev_uint32_t tag; while (evbuffer_get_length(evbuf) > 0) { @@ -321,7 +329,6 @@ msg_unmarshal(struct msg *tmp, struct evbuffer *evbuf) switch (tag) { case MSG_FROM_NAME: - if (tmp->from_name_set) return (-1); if (evtag_unmarshal_string(evbuf, MSG_FROM_NAME, &tmp->from_name_data) == -1) { @@ -330,9 +337,7 @@ msg_unmarshal(struct msg *tmp, struct evbuffer *evbuf) } tmp->from_name_set = 1; break; - case MSG_TO_NAME: - if (tmp->to_name_set) return (-1); if (evtag_unmarshal_string(evbuf, MSG_TO_NAME, &tmp->to_name_data) == -1) { @@ -341,23 +346,20 @@ msg_unmarshal(struct msg *tmp, struct evbuffer *evbuf) } tmp->to_name_set = 1; break; - case MSG_ATTACK: - if (tmp->attack_set) return (-1); tmp->attack_data = kill_new(); if (tmp->attack_data == NULL) return (-1); - if (evtag_unmarshal_kill(evbuf, MSG_ATTACK, tmp->attack_data) == -1) { + if (evtag_unmarshal_kill(evbuf, MSG_ATTACK, + tmp->attack_data) == -1) { event_warnx("%s: failed to unmarshal attack", __func__); return (-1); } tmp->attack_set = 1; break; - case MSG_RUN: - if (tmp->run_length >= tmp->run_num_allocated && msg_run_expand_to_hold_more(tmp) < 0) { puts("HEY NOW"); @@ -366,14 +368,14 @@ msg_unmarshal(struct msg *tmp, struct evbuffer *evbuf) tmp->run_data[tmp->run_length] = run_new(); if (tmp->run_data[tmp->run_length] == NULL) return (-1); - if (evtag_unmarshal_run(evbuf, MSG_RUN, tmp->run_data[tmp->run_length]) == -1) { + if (evtag_unmarshal_run(evbuf, MSG_RUN, + tmp->run_data[tmp->run_length]) == -1) { event_warnx("%s: failed to unmarshal run", __func__); return (-1); } ++tmp->run_length; tmp->run_set = 1; break; - default: return -1; } @@ -404,7 +406,8 @@ msg_complete(struct msg *msg) } int -evtag_unmarshal_msg(struct evbuffer *evbuf, ev_uint32_t need_tag, struct msg *msg) +evtag_unmarshal_msg(struct evbuffer *evbuf, ev_uint32_t need_tag, + struct msg *msg) { ev_uint32_t tag; int res = -1; @@ -425,13 +428,14 @@ evtag_unmarshal_msg(struct evbuffer *evbuf, ev_uint32_t need_tag, struct msg *ms } void -evtag_marshal_msg(struct evbuffer *evbuf, ev_uint32_t tag, const struct msg *msg) +evtag_marshal_msg(struct evbuffer *evbuf, ev_uint32_t tag, + const struct msg *msg) { struct evbuffer *buf_ = evbuffer_new(); assert(buf_ != NULL); msg_marshal(buf_, msg); evtag_marshal_buffer(evbuf, tag, buf_); - evbuffer_free(buf_); + evbuffer_free(buf_); } /* @@ -492,7 +496,8 @@ kill_how_often_expand_to_hold_more(struct kill *msg) return -1; msg->how_often_data = new_data; msg->how_often_num_allocated = tobe_allocated; - return 0;} + return 0; +} ev_uint32_t * kill_how_often_add(struct kill *msg, const ev_uint32_t value) @@ -535,7 +540,7 @@ kill_action_assign(struct kill *msg, int kill_how_often_assign(struct kill *msg, int off, - const ev_uint32_t value) + const ev_uint32_t value) { if (!msg->how_often_set || off < 0 || off >= msg->how_often_length) return (-1); @@ -615,7 +620,7 @@ kill_free(struct kill *tmp) } void -kill_marshal(struct evbuffer *evbuf, const struct kill *tmp){ +kill_marshal(struct evbuffer *evbuf, const struct kill *tmp) { evtag_marshal_string(evbuf, KILL_WEAPON, tmp->weapon_data); evtag_marshal_string(evbuf, KILL_ACTION, tmp->action_data); if (tmp->how_often_set) { @@ -629,7 +634,7 @@ kill_marshal(struct evbuffer *evbuf, const struct kill *tmp){ } int -kill_unmarshal(struct kill *tmp, struct evbuffer *evbuf) +kill_unmarshal(struct kill *tmp, struct evbuffer *evbuf) { ev_uint32_t tag; while (evbuffer_get_length(evbuf) > 0) { @@ -638,7 +643,6 @@ kill_unmarshal(struct kill *tmp, struct evbuffer *evbuf) switch (tag) { case KILL_WEAPON: - if (tmp->weapon_set) return (-1); if (evtag_unmarshal_string(evbuf, KILL_WEAPON, &tmp->weapon_data) == -1) { @@ -647,9 +651,7 @@ kill_unmarshal(struct kill *tmp, struct evbuffer *evbuf) } tmp->weapon_set = 1; break; - case KILL_ACTION: - if (tmp->action_set) return (-1); if (evtag_unmarshal_string(evbuf, KILL_ACTION, &tmp->action_data) == -1) { @@ -658,9 +660,7 @@ kill_unmarshal(struct kill *tmp, struct evbuffer *evbuf) } tmp->action_set = 1; break; - case KILL_HOW_OFTEN: - if (tmp->how_often_length >= tmp->how_often_num_allocated && kill_how_often_expand_to_hold_more(tmp) < 0) { puts("HEY NOW"); @@ -673,7 +673,6 @@ kill_unmarshal(struct kill *tmp, struct evbuffer *evbuf) ++tmp->how_often_length; tmp->how_often_set = 1; break; - default: return -1; } @@ -695,7 +694,8 @@ kill_complete(struct kill *msg) } int -evtag_unmarshal_kill(struct evbuffer *evbuf, ev_uint32_t need_tag, struct kill *msg) +evtag_unmarshal_kill(struct evbuffer *evbuf, ev_uint32_t need_tag, + struct kill *msg) { ev_uint32_t tag; int res = -1; @@ -716,13 +716,14 @@ evtag_unmarshal_kill(struct evbuffer *evbuf, ev_uint32_t need_tag, struct kill * } void -evtag_marshal_kill(struct evbuffer *evbuf, ev_uint32_t tag, const struct kill *msg) +evtag_marshal_kill(struct evbuffer *evbuf, ev_uint32_t tag, + const struct kill *msg) { struct evbuffer *buf_ = evbuffer_new(); assert(buf_ != NULL); kill_marshal(buf_, msg); evtag_marshal_buffer(evbuf, tag, buf_); - evbuffer_free(buf_); + evbuffer_free(buf_); } /* @@ -803,7 +804,8 @@ run_notes_expand_to_hold_more(struct run *msg) return -1; msg->notes_data = new_data; msg->notes_num_allocated = tobe_allocated; - return 0;} + return 0; +} char * * run_notes_add(struct run *msg, const char * value) @@ -840,7 +842,8 @@ run_other_numbers_expand_to_hold_more(struct run *msg) return -1; msg->other_numbers_data = new_data; msg->other_numbers_num_allocated = tobe_allocated; - return 0;} + return 0; +} ev_uint32_t * run_other_numbers_add(struct run *msg, const ev_uint32_t value) @@ -893,7 +896,7 @@ run_fixed_bytes_assign(struct run *msg, const ev_uint8_t *value) int run_notes_assign(struct run *msg, int off, - const char * value) + const char * value) { if (!msg->notes_set || off < 0 || off >= msg->notes_length) return (-1); @@ -920,7 +923,7 @@ run_large_number_assign(struct run *msg, const ev_uint64_t value) int run_other_numbers_assign(struct run *msg, int off, - const ev_uint32_t value) + const ev_uint32_t value) { if (!msg->other_numbers_set || off < 0 || off >= msg->other_numbers_length) return (-1); @@ -1056,7 +1059,7 @@ run_free(struct run *tmp) } void -run_marshal(struct evbuffer *evbuf, const struct run *tmp){ +run_marshal(struct evbuffer *evbuf, const struct run *tmp) { evtag_marshal_string(evbuf, RUN_HOW, tmp->how_data); if (tmp->some_bytes_set) { evtag_marshal(evbuf, RUN_SOME_BYTES, tmp->some_bytes_data, tmp->some_bytes_length); @@ -1084,7 +1087,7 @@ run_marshal(struct evbuffer *evbuf, const struct run *tmp){ } int -run_unmarshal(struct run *tmp, struct evbuffer *evbuf) +run_unmarshal(struct run *tmp, struct evbuffer *evbuf) { ev_uint32_t tag; while (evbuffer_get_length(evbuf) > 0) { @@ -1093,7 +1096,6 @@ run_unmarshal(struct run *tmp, struct evbuffer *evbuf) switch (tag) { case RUN_HOW: - if (tmp->how_set) return (-1); if (evtag_unmarshal_string(evbuf, RUN_HOW, &tmp->how_data) == -1) { @@ -1102,9 +1104,7 @@ run_unmarshal(struct run *tmp, struct evbuffer *evbuf) } tmp->how_set = 1; break; - case RUN_SOME_BYTES: - if (tmp->some_bytes_set) return (-1); if (evtag_payload_length(evbuf, &tmp->some_bytes_length) == -1) @@ -1119,9 +1119,7 @@ run_unmarshal(struct run *tmp, struct evbuffer *evbuf) } tmp->some_bytes_set = 1; break; - case RUN_FIXED_BYTES: - if (tmp->fixed_bytes_set) return (-1); if (evtag_unmarshal_fixed(evbuf, RUN_FIXED_BYTES, tmp->fixed_bytes_data, (24)) == -1) { @@ -1130,9 +1128,7 @@ run_unmarshal(struct run *tmp, struct evbuffer *evbuf) } tmp->fixed_bytes_set = 1; break; - case RUN_NOTES: - if (tmp->notes_length >= tmp->notes_num_allocated && run_notes_expand_to_hold_more(tmp) < 0) { puts("HEY NOW"); @@ -1145,9 +1141,7 @@ run_unmarshal(struct run *tmp, struct evbuffer *evbuf) ++tmp->notes_length; tmp->notes_set = 1; break; - case RUN_LARGE_NUMBER: - if (tmp->large_number_set) return (-1); if (evtag_unmarshal_int64(evbuf, RUN_LARGE_NUMBER, &tmp->large_number_data) == -1) { @@ -1156,9 +1150,7 @@ run_unmarshal(struct run *tmp, struct evbuffer *evbuf) } tmp->large_number_set = 1; break; - case RUN_OTHER_NUMBERS: - if (tmp->other_numbers_length >= tmp->other_numbers_num_allocated && run_other_numbers_expand_to_hold_more(tmp) < 0) { puts("HEY NOW"); @@ -1171,7 +1163,6 @@ run_unmarshal(struct run *tmp, struct evbuffer *evbuf) ++tmp->other_numbers_length; tmp->other_numbers_set = 1; break; - default: return -1; } @@ -1193,7 +1184,8 @@ run_complete(struct run *msg) } int -evtag_unmarshal_run(struct evbuffer *evbuf, ev_uint32_t need_tag, struct run *msg) +evtag_unmarshal_run(struct evbuffer *evbuf, ev_uint32_t need_tag, + struct run *msg) { ev_uint32_t tag; int res = -1; @@ -1214,12 +1206,13 @@ evtag_unmarshal_run(struct evbuffer *evbuf, ev_uint32_t need_tag, struct run *ms } void -evtag_marshal_run(struct evbuffer *evbuf, ev_uint32_t tag, const struct run *msg) +evtag_marshal_run(struct evbuffer *evbuf, ev_uint32_t tag, + const struct run *msg) { struct evbuffer *buf_ = evbuffer_new(); assert(buf_ != NULL); run_marshal(buf_, msg); evtag_marshal_buffer(evbuf, tag, buf_); - evbuffer_free(buf_); + evbuffer_free(buf_); } |