@@ -35,42 +35,13 @@ static order_t *order_create_internal(
3535 return NULL ;
3636 }
3737 memset (order_local_var , 0 , sizeof (order_t ));
38- if (id ) {
39- order_local_var -> id = malloc (sizeof (long ));
40- if (!order_local_var -> id ) {
41- order_free (order_local_var );
42- return NULL ;
43- }
44- * order_local_var -> id = * id ;
45- }
46- if (pet_id ) {
47- order_local_var -> pet_id = malloc (sizeof (long ));
48- if (!order_local_var -> pet_id ) {
49- order_free (order_local_var );
50- return NULL ;
51- }
52- * order_local_var -> pet_id = * pet_id ;
53- }
54- if (quantity ) {
55- order_local_var -> quantity = malloc (sizeof (int ));
56- if (!order_local_var -> quantity ) {
57- order_free (order_local_var );
58- return NULL ;
59- }
60- * order_local_var -> quantity = * quantity ;
61- }
38+ order_local_var -> _library_owned = 1 ;
39+ order_local_var -> id = id ;
40+ order_local_var -> pet_id = pet_id ;
41+ order_local_var -> quantity = quantity ;
6242 order_local_var -> ship_date = ship_date ;
6343 order_local_var -> status = status ;
64- if (complete ) {
65- order_local_var -> complete = malloc (sizeof (int ));
66- if (!order_local_var -> complete ) {
67- order_free (order_local_var );
68- return NULL ;
69- }
70- * order_local_var -> complete = * complete ;
71- }
72-
73- order_local_var -> _library_owned = 1 ;
44+ order_local_var -> complete = complete ;
7445 return order_local_var ;
7546}
7647
@@ -82,13 +53,33 @@ __attribute__((deprecated)) order_t *order_create(
8253 openapi_petstore_order_STATUS_e status ,
8354 int * complete
8455 ) {
56+ long * id_copy = NULL ;
57+ if (id ) {
58+ id_copy = malloc (sizeof (long ));
59+ if (id_copy ) * id_copy = * id ;
60+ }
61+ long * pet_id_copy = NULL ;
62+ if (pet_id ) {
63+ pet_id_copy = malloc (sizeof (long ));
64+ if (pet_id_copy ) * pet_id_copy = * pet_id ;
65+ }
66+ int * quantity_copy = NULL ;
67+ if (quantity ) {
68+ quantity_copy = malloc (sizeof (int ));
69+ if (quantity_copy ) * quantity_copy = * quantity ;
70+ }
71+ int * complete_copy = NULL ;
72+ if (complete ) {
73+ complete_copy = malloc (sizeof (int ));
74+ if (complete_copy ) * complete_copy = * complete ;
75+ }
8576 return order_create_internal (
86- id ,
87- pet_id ,
88- quantity ,
77+ id_copy ,
78+ pet_id_copy ,
79+ quantity_copy ,
8980 ship_date ,
9081 status ,
91- complete
82+ complete_copy
9283 );
9384}
9485
0 commit comments