Note: @ctx will *not* be freed! */
| 79 | |
| 80 | /* Note: @ctx will *not* be freed! */ |
| 81 | void context_destroy(enum osips_context ctxtype, context_p ctx) |
| 82 | { |
| 83 | int f = 0; |
| 84 | int n; |
| 85 | int i; |
| 86 | str *s; |
| 87 | void *p; |
| 88 | |
| 89 | |
| 90 | /* int ctx */ |
| 91 | for (n = 0; n < type_sizes[ctxtype][CONTEXT_INT_TYPE]; n++, f++) |
| 92 | if (context_destroy_array[ctxtype][f]) { |
| 93 | i = context_get_int(ctxtype, ctx, n); |
| 94 | if (i)/* XXX: should we call for 0 values? */ |
| 95 | context_destroy_array[ctxtype][f](&i); |
| 96 | } |
| 97 | |
| 98 | /* str ctx */ |
| 99 | for (n = 0; n < type_sizes[ctxtype][CONTEXT_STR_TYPE]; n++, f++) |
| 100 | if (context_destroy_array[ctxtype][f]) { |
| 101 | s = context_get_str(ctxtype, ctx, n); |
| 102 | if (s)/* XXX: how do we determine if s is empty? */ |
| 103 | context_destroy_array[ctxtype][f](s); |
| 104 | } |
| 105 | |
| 106 | /* ptr ctx */ |
| 107 | for (n = 0; n < type_sizes[ctxtype][CONTEXT_PTR_TYPE]; n++, f++) { |
| 108 | if (context_destroy_array[ctxtype][f]) { |
| 109 | p = context_get_ptr(ctxtype, ctx, n); |
| 110 | if (p) |
| 111 | context_destroy_array[ctxtype][f](p); |
| 112 | } |
| 113 | } |
| 114 | } |
| 115 | |
| 116 | context_p context_alloc(enum osips_context type) |
| 117 | { |
no test coverage detected