Commit 9e7b137d7b084826e8e4d99aee9ea2056afbce0a
1 parent
68bd42e3
make create response and request also callable vith an va_list argument.
Showing
2 changed files
with
24 additions
and
10 deletions
@@ -47,7 +47,9 @@ TR_INTERFACE(TR_Protocol) { | @@ -47,7 +47,9 @@ TR_INTERFACE(TR_Protocol) { | ||
47 | }; | 47 | }; |
48 | 48 | ||
49 | TR_ProtoMessage TR_protoCreateMessage(void *, TR_Socket); | 49 | TR_ProtoMessage TR_protoCreateMessage(void *, TR_Socket); |
50 | +TR_ProtoMessage TR_vprotoCreateRequest(void *, TR_Socket, va_list*); | ||
50 | TR_ProtoMessage TR_protoCreateRequest(void *, TR_Socket, ...); | 51 | TR_ProtoMessage TR_protoCreateRequest(void *, TR_Socket, ...); |
52 | +TR_ProtoMessage TR_vprotoCreateResponse(void *, TR_Socket, va_list*); | ||
51 | TR_ProtoMessage TR_protoCreateResponse(void *, TR_Socket, ...); | 53 | TR_ProtoMessage TR_protoCreateResponse(void *, TR_Socket, ...); |
52 | size_t TR_protoParse(void *, TR_ProtoMessage, TR_RemoteData); | 54 | size_t TR_protoParse(void *, TR_ProtoMessage, TR_RemoteData); |
53 | TR_RemoteData TR_protoCompose(void *, TR_ProtoMessage); | 55 | TR_RemoteData TR_protoCompose(void *, TR_ProtoMessage); |
@@ -42,34 +42,46 @@ TR_protoCreateMessage(void * _this, TR_Socket remote) | @@ -42,34 +42,46 @@ TR_protoCreateMessage(void * _this, TR_Socket remote) | ||
42 | } | 42 | } |
43 | 43 | ||
44 | TR_ProtoMessage | 44 | TR_ProtoMessage |
45 | -TR_protoCreateRequest(void * _this, TR_Socket remote, ...) | 45 | +TR_vprotoCreateRequest(void * _this, TR_Socket remote, va_list * params) |
46 | { | 46 | { |
47 | TR_ProtoMessage callret; | 47 | TR_ProtoMessage callret; |
48 | - va_list params; | ||
49 | - | ||
50 | - va_start(params, remote); | ||
51 | - TR_RETCALL(_this, TR_Protocol, createRequest, callret, ¶ms); | 48 | + TR_RETCALL(_this, TR_Protocol, createRequest, callret, params); |
52 | if (callret != NULL) { | 49 | if (callret != NULL) { |
53 | callret->remote = remote; | 50 | callret->remote = remote; |
54 | } | 51 | } |
55 | - va_end(params); | ||
56 | - | ||
57 | return callret; | 52 | return callret; |
58 | } | 53 | } |
59 | 54 | ||
60 | TR_ProtoMessage | 55 | TR_ProtoMessage |
61 | -TR_protoCreateResponse(void * _this, TR_Socket remote, ...) | 56 | +TR_protoCreateRequest(void * _this, TR_Socket remote, ...) |
62 | { | 57 | { |
63 | TR_ProtoMessage callret; | 58 | TR_ProtoMessage callret; |
64 | va_list params; | 59 | va_list params; |
65 | - | ||
66 | va_start(params, remote); | 60 | va_start(params, remote); |
61 | + callret = TR_vprotoCreateRequest(_this, remote, ¶ms); | ||
62 | + va_end(params); | ||
63 | + return callret; | ||
64 | +} | ||
65 | + | ||
66 | +TR_ProtoMessage | ||
67 | +TR_vprotoCreateResponse(void * _this, TR_Socket remote, va_list * params) | ||
68 | +{ | ||
69 | + TR_ProtoMessage callret; | ||
67 | TR_RETCALL(_this, TR_Protocol, createResponse, callret, ¶ms); | 70 | TR_RETCALL(_this, TR_Protocol, createResponse, callret, ¶ms); |
68 | if (callret != NULL) { | 71 | if (callret != NULL) { |
69 | callret->remote = remote; | 72 | callret->remote = remote; |
70 | } | 73 | } |
71 | - va_end(params); | 74 | + return callret; |
75 | +} | ||
72 | 76 | ||
77 | +TR_ProtoMessage | ||
78 | +TR_protoCreateResponse(void * _this, TR_Socket remote, ...) | ||
79 | +{ | ||
80 | + TR_ProtoMessage callret; | ||
81 | + va_list params; | ||
82 | + va_start(params, remote); | ||
83 | + callret = TR_vprotoCreateResponse(_this, remote, ¶ms); | ||
84 | + va_end(params); | ||
73 | return callret; | 85 | return callret; |
74 | } | 86 | } |
75 | 87 |
Please
register
or
login
to post a comment