Lines Matching refs:tmp
56 struct msg *tmp; in msg_new_with_arg() local
57 if ((tmp = malloc(sizeof(struct msg))) == NULL) { in msg_new_with_arg()
61 tmp->base = &msg_base__; in msg_new_with_arg()
63 tmp->from_name_data = NULL; in msg_new_with_arg()
64 tmp->from_name_set = 0; in msg_new_with_arg()
66 tmp->to_name_data = NULL; in msg_new_with_arg()
67 tmp->to_name_set = 0; in msg_new_with_arg()
69 tmp->attack_data = NULL; in msg_new_with_arg()
70 tmp->attack_set = 0; in msg_new_with_arg()
72 tmp->run_data = NULL; in msg_new_with_arg()
73 tmp->run_length = 0; in msg_new_with_arg()
74 tmp->run_num_allocated = 0; in msg_new_with_arg()
75 tmp->run_set = 0; in msg_new_with_arg()
77 return (tmp); in msg_new_with_arg()
143 struct evbuffer *tmp = NULL; in msg_attack_assign() local
154 if ((tmp = evbuffer_new()) == NULL) { in msg_attack_assign()
158 kill_marshal(tmp, value); in msg_attack_assign()
159 if (kill_unmarshal(msg->attack_data, tmp) == -1) { in msg_attack_assign()
164 evbuffer_free(tmp); in msg_attack_assign()
167 if (tmp != NULL) in msg_attack_assign()
168 evbuffer_free(tmp); in msg_attack_assign()
185 struct evbuffer *tmp = NULL; in msg_run_assign() local
187 if ((tmp = evbuffer_new()) == NULL) { in msg_run_assign()
192 run_marshal(tmp, value); in msg_run_assign()
193 if (run_unmarshal(msg->run_data[off], tmp) == -1) { in msg_run_assign()
199 if (tmp != NULL) in msg_run_assign()
200 evbuffer_free(tmp); in msg_run_assign()
251 msg_clear(struct msg *tmp) in msg_clear() argument
253 if (tmp->from_name_set == 1) { in msg_clear()
254 free(tmp->from_name_data); in msg_clear()
255 tmp->from_name_data = NULL; in msg_clear()
256 tmp->from_name_set = 0; in msg_clear()
258 if (tmp->to_name_set == 1) { in msg_clear()
259 free(tmp->to_name_data); in msg_clear()
260 tmp->to_name_data = NULL; in msg_clear()
261 tmp->to_name_set = 0; in msg_clear()
263 if (tmp->attack_set == 1) { in msg_clear()
264 kill_free(tmp->attack_data); in msg_clear()
265 tmp->attack_data = NULL; in msg_clear()
266 tmp->attack_set = 0; in msg_clear()
268 if (tmp->run_set == 1) { in msg_clear()
270 for (i = 0; i < tmp->run_length; ++i) { in msg_clear()
271 run_free(tmp->run_data[i]); in msg_clear()
273 free(tmp->run_data); in msg_clear()
274 tmp->run_data = NULL; in msg_clear()
275 tmp->run_set = 0; in msg_clear()
276 tmp->run_length = 0; in msg_clear()
277 tmp->run_num_allocated = 0; in msg_clear()
282 msg_free(struct msg *tmp) in msg_free() argument
284 if (tmp->from_name_data != NULL) in msg_free()
285 free (tmp->from_name_data); in msg_free()
286 if (tmp->to_name_data != NULL) in msg_free()
287 free (tmp->to_name_data); in msg_free()
288 if (tmp->attack_data != NULL) in msg_free()
289 kill_free(tmp->attack_data); in msg_free()
290 if (tmp->run_set == 1) { in msg_free()
292 for (i = 0; i < tmp->run_length; ++i) { in msg_free()
293 run_free(tmp->run_data[i]); in msg_free()
295 free(tmp->run_data); in msg_free()
296 tmp->run_data = NULL; in msg_free()
297 tmp->run_set = 0; in msg_free()
298 tmp->run_length = 0; in msg_free()
299 tmp->run_num_allocated = 0; in msg_free()
301 free(tmp->run_data); in msg_free()
302 free(tmp); in msg_free()
306 msg_marshal(struct evbuffer *evbuf, const struct msg *tmp) { in msg_marshal() argument
307 evtag_marshal_string(evbuf, MSG_FROM_NAME, tmp->from_name_data); in msg_marshal()
308 evtag_marshal_string(evbuf, MSG_TO_NAME, tmp->to_name_data); in msg_marshal()
309 if (tmp->attack_set) { in msg_marshal()
310 evtag_marshal_kill(evbuf, MSG_ATTACK, tmp->attack_data); in msg_marshal()
312 if (tmp->run_set) { in msg_marshal()
315 for (i = 0; i < tmp->run_length; ++i) { in msg_marshal()
316 evtag_marshal_run(evbuf, MSG_RUN, tmp->run_data[i]); in msg_marshal()
323 msg_unmarshal(struct msg *tmp, struct evbuffer *evbuf) in msg_unmarshal() argument
332 if (tmp->from_name_set) in msg_unmarshal()
334 if (evtag_unmarshal_string(evbuf, MSG_FROM_NAME, &tmp->from_name_data) == -1) { in msg_unmarshal()
338 tmp->from_name_set = 1; in msg_unmarshal()
341 if (tmp->to_name_set) in msg_unmarshal()
343 if (evtag_unmarshal_string(evbuf, MSG_TO_NAME, &tmp->to_name_data) == -1) { in msg_unmarshal()
347 tmp->to_name_set = 1; in msg_unmarshal()
350 if (tmp->attack_set) in msg_unmarshal()
352 tmp->attack_data = kill_new(); in msg_unmarshal()
353 if (tmp->attack_data == NULL) in msg_unmarshal()
356 tmp->attack_data) == -1) { in msg_unmarshal()
360 tmp->attack_set = 1; in msg_unmarshal()
363 if (tmp->run_length >= tmp->run_num_allocated && in msg_unmarshal()
364 msg_run_expand_to_hold_more(tmp) < 0) { in msg_unmarshal()
368 tmp->run_data[tmp->run_length] = run_new(); in msg_unmarshal()
369 if (tmp->run_data[tmp->run_length] == NULL) in msg_unmarshal()
372 tmp->run_data[tmp->run_length]) == -1) { in msg_unmarshal()
376 ++tmp->run_length; in msg_unmarshal()
377 tmp->run_set = 1; in msg_unmarshal()
384 if (msg_complete(tmp) == -1) in msg_unmarshal()
415 struct evbuffer *tmp = evbuffer_new(); in evtag_unmarshal_msg() local
417 if (evtag_unmarshal(evbuf, &tag, tmp) == -1 || tag != need_tag) in evtag_unmarshal_msg()
420 if (msg_unmarshal(msg, tmp) == -1) in evtag_unmarshal_msg()
426 evbuffer_free(tmp); in evtag_unmarshal_msg()
464 struct kill *tmp; in kill_new_with_arg() local
465 if ((tmp = malloc(sizeof(struct kill))) == NULL) { in kill_new_with_arg()
469 tmp->base = &kill_base__; in kill_new_with_arg()
471 tmp->weapon_data = NULL; in kill_new_with_arg()
472 tmp->weapon_set = 0; in kill_new_with_arg()
474 tmp->action_data = NULL; in kill_new_with_arg()
475 tmp->action_set = 0; in kill_new_with_arg()
477 tmp->how_often_data = NULL; in kill_new_with_arg()
478 tmp->how_often_length = 0; in kill_new_with_arg()
479 tmp->how_often_num_allocated = 0; in kill_new_with_arg()
480 tmp->how_often_set = 0; in kill_new_with_arg()
482 return (tmp); in kill_new_with_arg()
583 kill_clear(struct kill *tmp) in kill_clear() argument
585 if (tmp->weapon_set == 1) { in kill_clear()
586 free(tmp->weapon_data); in kill_clear()
587 tmp->weapon_data = NULL; in kill_clear()
588 tmp->weapon_set = 0; in kill_clear()
590 if (tmp->action_set == 1) { in kill_clear()
591 free(tmp->action_data); in kill_clear()
592 tmp->action_data = NULL; in kill_clear()
593 tmp->action_set = 0; in kill_clear()
595 if (tmp->how_often_set == 1) { in kill_clear()
596 free(tmp->how_often_data); in kill_clear()
597 tmp->how_often_data = NULL; in kill_clear()
598 tmp->how_often_set = 0; in kill_clear()
599 tmp->how_often_length = 0; in kill_clear()
600 tmp->how_often_num_allocated = 0; in kill_clear()
605 kill_free(struct kill *tmp) in kill_free() argument
607 if (tmp->weapon_data != NULL) in kill_free()
608 free (tmp->weapon_data); in kill_free()
609 if (tmp->action_data != NULL) in kill_free()
610 free (tmp->action_data); in kill_free()
611 if (tmp->how_often_set == 1) { in kill_free()
612 free(tmp->how_often_data); in kill_free()
613 tmp->how_often_data = NULL; in kill_free()
614 tmp->how_often_set = 0; in kill_free()
615 tmp->how_often_length = 0; in kill_free()
616 tmp->how_often_num_allocated = 0; in kill_free()
618 free(tmp->how_often_data); in kill_free()
619 free(tmp); in kill_free()
623 kill_marshal(struct evbuffer *evbuf, const struct kill *tmp) { in kill_marshal() argument
624 evtag_marshal_string(evbuf, KILL_WEAPON, tmp->weapon_data); in kill_marshal()
625 evtag_marshal_string(evbuf, KILL_ACTION, tmp->action_data); in kill_marshal()
626 if (tmp->how_often_set) { in kill_marshal()
629 for (i = 0; i < tmp->how_often_length; ++i) { in kill_marshal()
630 evtag_marshal_int(evbuf, KILL_HOW_OFTEN, tmp->how_often_data[i]); in kill_marshal()
637 kill_unmarshal(struct kill *tmp, struct evbuffer *evbuf) in kill_unmarshal() argument
646 if (tmp->weapon_set) in kill_unmarshal()
648 if (evtag_unmarshal_string(evbuf, KILL_WEAPON, &tmp->weapon_data) == -1) { in kill_unmarshal()
652 tmp->weapon_set = 1; in kill_unmarshal()
655 if (tmp->action_set) in kill_unmarshal()
657 if (evtag_unmarshal_string(evbuf, KILL_ACTION, &tmp->action_data) == -1) { in kill_unmarshal()
661 tmp->action_set = 1; in kill_unmarshal()
664 if (tmp->how_often_length >= tmp->how_often_num_allocated && in kill_unmarshal()
665 kill_how_often_expand_to_hold_more(tmp) < 0) { in kill_unmarshal()
669 …if (evtag_unmarshal_int(evbuf, KILL_HOW_OFTEN, &tmp->how_often_data[tmp->how_often_length]) == -1)… in kill_unmarshal()
673 ++tmp->how_often_length; in kill_unmarshal()
674 tmp->how_often_set = 1; in kill_unmarshal()
681 if (kill_complete(tmp) == -1) in kill_unmarshal()
703 struct evbuffer *tmp = evbuffer_new(); in evtag_unmarshal_kill() local
705 if (evtag_unmarshal(evbuf, &tag, tmp) == -1 || tag != need_tag) in evtag_unmarshal_kill()
708 if (kill_unmarshal(msg, tmp) == -1) in evtag_unmarshal_kill()
714 evbuffer_free(tmp); in evtag_unmarshal_kill()
759 struct run *tmp; in run_new_with_arg() local
760 if ((tmp = malloc(sizeof(struct run))) == NULL) { in run_new_with_arg()
764 tmp->base = &run_base__; in run_new_with_arg()
766 tmp->how_data = NULL; in run_new_with_arg()
767 tmp->how_set = 0; in run_new_with_arg()
769 tmp->some_bytes_data = NULL; in run_new_with_arg()
770 tmp->some_bytes_length = 0; in run_new_with_arg()
771 tmp->some_bytes_set = 0; in run_new_with_arg()
773 memset(tmp->fixed_bytes_data, 0, sizeof(tmp->fixed_bytes_data)); in run_new_with_arg()
774 tmp->fixed_bytes_set = 0; in run_new_with_arg()
776 tmp->notes_data = NULL; in run_new_with_arg()
777 tmp->notes_length = 0; in run_new_with_arg()
778 tmp->notes_num_allocated = 0; in run_new_with_arg()
779 tmp->notes_set = 0; in run_new_with_arg()
781 tmp->large_number_data = 0; in run_new_with_arg()
782 tmp->large_number_set = 0; in run_new_with_arg()
784 tmp->other_numbers_data = NULL; in run_new_with_arg()
785 tmp->other_numbers_length = 0; in run_new_with_arg()
786 tmp->other_numbers_num_allocated = 0; in run_new_with_arg()
787 tmp->other_numbers_set = 0; in run_new_with_arg()
789 return (tmp); in run_new_with_arg()
995 run_clear(struct run *tmp) in run_clear() argument
997 if (tmp->how_set == 1) { in run_clear()
998 free(tmp->how_data); in run_clear()
999 tmp->how_data = NULL; in run_clear()
1000 tmp->how_set = 0; in run_clear()
1002 if (tmp->some_bytes_set == 1) { in run_clear()
1003 free (tmp->some_bytes_data); in run_clear()
1004 tmp->some_bytes_data = NULL; in run_clear()
1005 tmp->some_bytes_length = 0; in run_clear()
1006 tmp->some_bytes_set = 0; in run_clear()
1008 tmp->fixed_bytes_set = 0; in run_clear()
1009 memset(tmp->fixed_bytes_data, 0, sizeof(tmp->fixed_bytes_data)); in run_clear()
1010 if (tmp->notes_set == 1) { in run_clear()
1012 for (i = 0; i < tmp->notes_length; ++i) { in run_clear()
1013 if (tmp->notes_data[i] != NULL) free(tmp->notes_data[i]); in run_clear()
1015 free(tmp->notes_data); in run_clear()
1016 tmp->notes_data = NULL; in run_clear()
1017 tmp->notes_set = 0; in run_clear()
1018 tmp->notes_length = 0; in run_clear()
1019 tmp->notes_num_allocated = 0; in run_clear()
1021 tmp->large_number_set = 0; in run_clear()
1022 if (tmp->other_numbers_set == 1) { in run_clear()
1023 free(tmp->other_numbers_data); in run_clear()
1024 tmp->other_numbers_data = NULL; in run_clear()
1025 tmp->other_numbers_set = 0; in run_clear()
1026 tmp->other_numbers_length = 0; in run_clear()
1027 tmp->other_numbers_num_allocated = 0; in run_clear()
1032 run_free(struct run *tmp) in run_free() argument
1034 if (tmp->how_data != NULL) in run_free()
1035 free (tmp->how_data); in run_free()
1036 if (tmp->some_bytes_data != NULL) in run_free()
1037 free(tmp->some_bytes_data); in run_free()
1038 if (tmp->notes_set == 1) { in run_free()
1040 for (i = 0; i < tmp->notes_length; ++i) { in run_free()
1041 if (tmp->notes_data[i] != NULL) free(tmp->notes_data[i]); in run_free()
1043 free(tmp->notes_data); in run_free()
1044 tmp->notes_data = NULL; in run_free()
1045 tmp->notes_set = 0; in run_free()
1046 tmp->notes_length = 0; in run_free()
1047 tmp->notes_num_allocated = 0; in run_free()
1049 free(tmp->notes_data); in run_free()
1050 if (tmp->other_numbers_set == 1) { in run_free()
1051 free(tmp->other_numbers_data); in run_free()
1052 tmp->other_numbers_data = NULL; in run_free()
1053 tmp->other_numbers_set = 0; in run_free()
1054 tmp->other_numbers_length = 0; in run_free()
1055 tmp->other_numbers_num_allocated = 0; in run_free()
1057 free(tmp->other_numbers_data); in run_free()
1058 free(tmp); in run_free()
1062 run_marshal(struct evbuffer *evbuf, const struct run *tmp) { in run_marshal() argument
1063 evtag_marshal_string(evbuf, RUN_HOW, tmp->how_data); in run_marshal()
1064 if (tmp->some_bytes_set) { in run_marshal()
1065 evtag_marshal(evbuf, RUN_SOME_BYTES, tmp->some_bytes_data, tmp->some_bytes_length); in run_marshal()
1067 evtag_marshal(evbuf, RUN_FIXED_BYTES, tmp->fixed_bytes_data, (24)); in run_marshal()
1068 if (tmp->notes_set) { in run_marshal()
1071 for (i = 0; i < tmp->notes_length; ++i) { in run_marshal()
1072 evtag_marshal_string(evbuf, RUN_NOTES, tmp->notes_data[i]); in run_marshal()
1076 if (tmp->large_number_set) { in run_marshal()
1077 evtag_marshal_int64(evbuf, RUN_LARGE_NUMBER, tmp->large_number_data); in run_marshal()
1079 if (tmp->other_numbers_set) { in run_marshal()
1082 for (i = 0; i < tmp->other_numbers_length; ++i) { in run_marshal()
1083 evtag_marshal_int(evbuf, RUN_OTHER_NUMBERS, tmp->other_numbers_data[i]); in run_marshal()
1090 run_unmarshal(struct run *tmp, struct evbuffer *evbuf) in run_unmarshal() argument
1099 if (tmp->how_set) in run_unmarshal()
1101 if (evtag_unmarshal_string(evbuf, RUN_HOW, &tmp->how_data) == -1) { in run_unmarshal()
1105 tmp->how_set = 1; in run_unmarshal()
1108 if (tmp->some_bytes_set) in run_unmarshal()
1110 if (evtag_payload_length(evbuf, &tmp->some_bytes_length) == -1) in run_unmarshal()
1112 if (tmp->some_bytes_length > evbuffer_get_length(evbuf)) in run_unmarshal()
1114 if ((tmp->some_bytes_data = malloc(tmp->some_bytes_length)) == NULL) in run_unmarshal()
1116 …if (evtag_unmarshal_fixed(evbuf, RUN_SOME_BYTES, tmp->some_bytes_data, tmp->some_bytes_length) == … in run_unmarshal()
1120 tmp->some_bytes_set = 1; in run_unmarshal()
1123 if (tmp->fixed_bytes_set) in run_unmarshal()
1125 if (evtag_unmarshal_fixed(evbuf, RUN_FIXED_BYTES, tmp->fixed_bytes_data, (24)) == -1) { in run_unmarshal()
1129 tmp->fixed_bytes_set = 1; in run_unmarshal()
1132 if (tmp->notes_length >= tmp->notes_num_allocated && in run_unmarshal()
1133 run_notes_expand_to_hold_more(tmp) < 0) { in run_unmarshal()
1137 if (evtag_unmarshal_string(evbuf, RUN_NOTES, &tmp->notes_data[tmp->notes_length]) == -1) { in run_unmarshal()
1141 ++tmp->notes_length; in run_unmarshal()
1142 tmp->notes_set = 1; in run_unmarshal()
1145 if (tmp->large_number_set) in run_unmarshal()
1147 if (evtag_unmarshal_int64(evbuf, RUN_LARGE_NUMBER, &tmp->large_number_data) == -1) { in run_unmarshal()
1151 tmp->large_number_set = 1; in run_unmarshal()
1154 if (tmp->other_numbers_length >= tmp->other_numbers_num_allocated && in run_unmarshal()
1155 run_other_numbers_expand_to_hold_more(tmp) < 0) { in run_unmarshal()
1159 …if (evtag_unmarshal_int(evbuf, RUN_OTHER_NUMBERS, &tmp->other_numbers_data[tmp->other_numbers_leng… in run_unmarshal()
1163 ++tmp->other_numbers_length; in run_unmarshal()
1164 tmp->other_numbers_set = 1; in run_unmarshal()
1171 if (run_complete(tmp) == -1) in run_unmarshal()
1193 struct evbuffer *tmp = evbuffer_new(); in evtag_unmarshal_run() local
1195 if (evtag_unmarshal(evbuf, &tag, tmp) == -1 || tag != need_tag) in evtag_unmarshal_run()
1198 if (run_unmarshal(msg, tmp) == -1) in evtag_unmarshal_run()
1204 evbuffer_free(tmp); in evtag_unmarshal_run()