| 1 |
|
| #define PERL_NO_GET_CONTEXT |
| 2 |
|
| #include "EXTERN.h" |
| 3 |
|
| #include "perl.h" |
| 4 |
|
| #include "XSUB.h" |
| 5 |
|
| #include "ppport.h" |
| 6 |
|
| |
| 7 |
|
| #include <stdint.h> |
| 8 |
|
| #include "define.h" |
| 9 |
|
| #include "type.h" |
| 10 |
|
| #include "proto.h" |
| 11 |
|
| |
| 12 |
350 |
| int unpack_type_nocroak(pTHX_ unsigned char *input, STRLEN len, STRLEN *pos, struct cc_type *output) |
| 13 |
|
| { |
| 14 |
350 |
▶ | if (UNLIKELY(unpack_short_nocroak(aTHX_ input, len, pos, &output->type_id) != 0)) |
Branch: 1 branch
| Branch | True | False | Total |
| if (UNLIKELY(unpack_short_nocroak(aTHX_ input, len, pos, &output->type_id) != 0)) |
0 |
350 |
350 |
|
| 15 |
0 |
| return -1; |
| 16 |
|
| |
| 17 |
350 |
▶ | if (output->type_id > 0 && output->type_id < 0x20) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (output->type_id > 0 && output->type_id < 0x20) { |
346 |
4 |
350 |
| if (output->type_id > 0 && output->type_id < 0x20) { |
319 |
27 |
346 |
|
| 18 |
|
| /* Primitives. No further decoding needed */ |
| 19 |
|
| |
| 20 |
31 |
▶ | } else if (output->type_id == CC_TYPE_CUSTOM) { |
Branch: 1 branch
| Branch | True | False | Total |
| } else if (output->type_id == CC_TYPE_CUSTOM) { |
4 |
27 |
31 |
|
| 21 |
|
| char *custom_type; |
| 22 |
|
| STRLEN type_length; |
| 23 |
4 |
▶ | if (UNLIKELY(unpack_string_nocroak(aTHX_ input, len, pos, &custom_type, &type_length) != 0)) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (UNLIKELY(unpack_string_nocroak(aTHX_ input, len, pos, &custom_type, &type_length) != 0)) { |
0 |
4 |
4 |
|
| 24 |
0 |
| return -3; |
| 25 |
|
| } |
| 26 |
4 |
| const char *marshal_prefix = "org.apache.cassandra.db.marshal."; |
| 27 |
4 |
▶ | if (type_length > strlen(marshal_prefix) && !memcmp(marshal_prefix, custom_type, strlen(marshal_prefix))) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (type_length > strlen(marshal_prefix) && !memcmp(marshal_prefix, custom_type, strlen(marshal_prefix))) { |
0 |
4 |
4 |
| if (type_length > strlen(marshal_prefix) && !memcmp(marshal_prefix, custom_type, strlen(marshal_prefix))) { |
0 |
0 |
0 |
|
| 28 |
|
| char *marshal_type; |
| 29 |
|
| STRLEN marshal_type_length; |
| 30 |
|
| |
| 31 |
0 |
| marshal_type = custom_type + strlen(marshal_prefix); |
| 32 |
0 |
| marshal_type_length = type_length - strlen(marshal_prefix); |
| 33 |
0 |
| switch(marshal_type_length) { |
| 34 |
0 |
| case 8: |
| 35 |
0 |
▶ | if (!memcmp(marshal_type, "UTF8Type", 8)) { output->type_id = CC_TYPE_VARCHAR; break; } |
Branch: 1 branch
| Branch | True | False | Total |
| if (!memcmp(marshal_type, "UTF8Type", 8)) { output->type_id = CC_TYPE_VARCHAR; break; } |
0 |
0 |
0 |
|
| 36 |
0 |
▶ | if (!memcmp(marshal_type, "UUIDType", 8)) { output->type_id = CC_TYPE_UUID; break; } |
Branch: 1 branch
| Branch | True | False | Total |
| if (!memcmp(marshal_type, "UUIDType", 8)) { output->type_id = CC_TYPE_UUID; break; } |
0 |
0 |
0 |
|
| 37 |
0 |
▶ | if (!memcmp(marshal_type, "TimeType", 8)) { output->type_id = CC_TYPE_TIME; break; } |
Branch: 1 branch
| Branch | True | False | Total |
| if (!memcmp(marshal_type, "TimeType", 8)) { output->type_id = CC_TYPE_TIME; break; } |
0 |
0 |
0 |
|
| 38 |
0 |
▶ | if (!memcmp(marshal_type, "ByteType", 8)) { output->type_id = CC_TYPE_TINYINT; break; } |
Branch: 1 branch
| Branch | True | False | Total |
| if (!memcmp(marshal_type, "ByteType", 8)) { output->type_id = CC_TYPE_TINYINT; break; } |
0 |
0 |
0 |
|
| 39 |
0 |
▶ | if (!memcmp(marshal_type, "DateType", 8)) { output->type_id = CC_TYPE_DATE; break; } |
Branch: 1 branch
| Branch | True | False | Total |
| if (!memcmp(marshal_type, "DateType", 8)) { output->type_id = CC_TYPE_DATE; break; } |
0 |
0 |
0 |
|
| 40 |
0 |
▶ | if (!memcmp(marshal_type, "LongType", 8)) { output->type_id = CC_TYPE_BIGINT; break; } |
Branch: 1 branch
| Branch | True | False | Total |
| if (!memcmp(marshal_type, "LongType", 8)) { output->type_id = CC_TYPE_BIGINT; break; } |
0 |
0 |
0 |
|
| 41 |
0 |
| break; |
| 42 |
0 |
| case 9: |
| 43 |
0 |
▶ | if (!memcmp(marshal_type, "AsciiType", 9)) { output->type_id = CC_TYPE_ASCII; break; } |
Branch: 1 branch
| Branch | True | False | Total |
| if (!memcmp(marshal_type, "AsciiType", 9)) { output->type_id = CC_TYPE_ASCII; break; } |
0 |
0 |
0 |
|
| 44 |
0 |
▶ | if (!memcmp(marshal_type, "Int32Type", 9)) { output->type_id = CC_TYPE_INT; break; } |
Branch: 1 branch
| Branch | True | False | Total |
| if (!memcmp(marshal_type, "Int32Type", 9)) { output->type_id = CC_TYPE_INT; break; } |
0 |
0 |
0 |
|
| 45 |
0 |
▶ | if (!memcmp(marshal_type, "BytesType", 9)) { output->type_id = CC_TYPE_BLOB; break; } |
Branch: 1 branch
| Branch | True | False | Total |
| if (!memcmp(marshal_type, "BytesType", 9)) { output->type_id = CC_TYPE_BLOB; break; } |
0 |
0 |
0 |
|
| 46 |
0 |
▶ | if (!memcmp(marshal_type, "FloatType", 9)) { output->type_id = CC_TYPE_FLOAT; break; } |
Branch: 1 branch
| Branch | True | False | Total |
| if (!memcmp(marshal_type, "FloatType", 9)) { output->type_id = CC_TYPE_FLOAT; break; } |
0 |
0 |
0 |
|
| 47 |
0 |
▶ | if (!memcmp(marshal_type, "ShortType", 9)) { output->type_id = CC_TYPE_SMALLINT; break; } |
Branch: 1 branch
| Branch | True | False | Total |
| if (!memcmp(marshal_type, "ShortType", 9)) { output->type_id = CC_TYPE_SMALLINT; break; } |
0 |
0 |
0 |
|
| 48 |
0 |
| break; |
| 49 |
0 |
| case 10: |
| 50 |
0 |
▶ | if (!memcmp(marshal_type, "DoubleType", 10)) { output->type_id = CC_TYPE_DOUBLE; break; } |
Branch: 1 branch
| Branch | True | False | Total |
| if (!memcmp(marshal_type, "DoubleType", 10)) { output->type_id = CC_TYPE_DOUBLE; break; } |
0 |
0 |
0 |
|
| 51 |
0 |
| break; |
| 52 |
0 |
| case 11: |
| 53 |
0 |
▶ | if (!memcmp(marshal_type, "BooleanType", 11)) { output->type_id = CC_TYPE_BOOLEAN; break; } |
Branch: 1 branch
| Branch | True | False | Total |
| if (!memcmp(marshal_type, "BooleanType", 11)) { output->type_id = CC_TYPE_BOOLEAN; break; } |
0 |
0 |
0 |
|
| 54 |
0 |
▶ | if (!memcmp(marshal_type, "DecimalType", 11)) { output->type_id = CC_TYPE_DECIMAL; break; } |
Branch: 1 branch
| Branch | True | False | Total |
| if (!memcmp(marshal_type, "DecimalType", 11)) { output->type_id = CC_TYPE_DECIMAL; break; } |
0 |
0 |
0 |
|
| 55 |
0 |
▶ | if (!memcmp(marshal_type, "IntegerType", 11)) { output->type_id = CC_TYPE_VARINT; break; } |
Branch: 1 branch
| Branch | True | False | Total |
| if (!memcmp(marshal_type, "IntegerType", 11)) { output->type_id = CC_TYPE_VARINT; break; } |
0 |
0 |
0 |
|
| 56 |
0 |
| break; |
| 57 |
0 |
| case 12: |
| 58 |
0 |
▶ | if (!memcmp(marshal_type, "TimeUUIDType", 12)) { output->type_id = CC_TYPE_TIMEUUID; break; } |
Branch: 1 branch
| Branch | True | False | Total |
| if (!memcmp(marshal_type, "TimeUUIDType", 12)) { output->type_id = CC_TYPE_TIMEUUID; break; } |
0 |
0 |
0 |
|
| 59 |
0 |
| break; |
| 60 |
0 |
| case 13: |
| 61 |
0 |
▶ | if (!memcmp(marshal_type, "TimestampType", 13)) { output->type_id = CC_TYPE_TIMESTAMP; break; } |
Branch: 1 branch
| Branch | True | False | Total |
| if (!memcmp(marshal_type, "TimestampType", 13)) { output->type_id = CC_TYPE_TIMESTAMP; break; } |
0 |
0 |
0 |
|
| 62 |
0 |
| break; |
| 63 |
0 |
| case 14: |
| 64 |
0 |
▶ | if (!memcmp(marshal_type, "SimpleDateType", 14)) { output->type_id = CC_TYPE_DATE; break; } |
Branch: 1 branch
| Branch | True | False | Total |
| if (!memcmp(marshal_type, "SimpleDateType", 14)) { output->type_id = CC_TYPE_DATE; break; } |
0 |
0 |
0 |
|
| 65 |
0 |
| break; |
| 66 |
0 |
| case 15: |
| 67 |
0 |
▶ | if (!memcmp(marshal_type, "InetAddressType", 15)) { output->type_id = CC_TYPE_INET; break; } |
Branch: 1 branch
| Branch | True | False | Total |
| if (!memcmp(marshal_type, "InetAddressType", 15)) { output->type_id = CC_TYPE_INET; break; } |
0 |
0 |
0 |
|
| 68 |
0 |
| break; |
| 69 |
0 |
| case 17: |
| 70 |
0 |
▶ | if (!memcmp(marshal_type, "CounterColumnType", 17)) { output->type_id = CC_TYPE_COUNTER; break; } |
Branch: 1 branch
| Branch | True | False | Total |
| if (!memcmp(marshal_type, "CounterColumnType", 17)) { output->type_id = CC_TYPE_COUNTER; break; } |
0 |
0 |
0 |
|
| 71 |
0 |
| break; |
| 72 |
|
| } |
| 73 |
|
| } |
| 74 |
|
| |
| 75 |
|
| /* If we made it this far, it's not a type we understand. So just copy the name and we're done. */ |
| 76 |
4 |
| Newxz(output->custom_name, type_length+1, char); |
| 77 |
4 |
| memcpy(output->custom_name, custom_type, type_length); |
| 78 |
|
| |
| 79 |
27 |
▶ | } else if (output->type_id == CC_TYPE_LIST) { |
Branch: 1 branch
| Branch | True | False | Total |
| } else if (output->type_id == CC_TYPE_LIST) { |
9 |
18 |
27 |
|
| 80 |
|
| struct cc_type *inner; |
| 81 |
9 |
| Newxz(inner, 1, struct cc_type); |
| 82 |
9 |
| output->inner_type = inner; |
| 83 |
|
| |
| 84 |
9 |
▶ | if (UNLIKELY(unpack_type_nocroak(aTHX_ input, len, pos, inner) != 0)) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (UNLIKELY(unpack_type_nocroak(aTHX_ input, len, pos, inner) != 0)) { |
0 |
9 |
9 |
|
| 85 |
0 |
| return -3; |
| 86 |
|
| } |
| 87 |
|
| |
| 88 |
18 |
▶ | } else if (output->type_id == CC_TYPE_MAP) { |
Branch: 1 branch
| Branch | True | False | Total |
| } else if (output->type_id == CC_TYPE_MAP) { |
9 |
9 |
18 |
|
| 89 |
9 |
| Newxz(output->inner_type, 2, struct cc_type); |
| 90 |
|
| |
| 91 |
9 |
▶ | if (UNLIKELY(unpack_type_nocroak(aTHX_ input, len, pos, &output->inner_type[0]) != 0)) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (UNLIKELY(unpack_type_nocroak(aTHX_ input, len, pos, &output->inner_type[0]) != 0)) { |
0 |
9 |
9 |
|
| 92 |
0 |
| return -3; |
| 93 |
|
| } |
| 94 |
9 |
▶ | if (UNLIKELY(unpack_type_nocroak(aTHX_ input, len, pos, &output->inner_type[1]) != 0)) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (UNLIKELY(unpack_type_nocroak(aTHX_ input, len, pos, &output->inner_type[1]) != 0)) { |
0 |
9 |
9 |
|
| 95 |
0 |
| return -3; |
| 96 |
|
| } |
| 97 |
|
| |
| 98 |
9 |
▶ | } else if (output->type_id == CC_TYPE_SET) { |
Branch: 1 branch
| Branch | True | False | Total |
| } else if (output->type_id == CC_TYPE_SET) { |
4 |
5 |
9 |
|
| 99 |
|
| struct cc_type *inner; |
| 100 |
4 |
| Newxz(inner, 1, struct cc_type); |
| 101 |
4 |
| output->inner_type = inner; |
| 102 |
|
| |
| 103 |
4 |
▶ | if (UNLIKELY(unpack_type_nocroak(aTHX_ input, len, pos, inner) != 0)) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (UNLIKELY(unpack_type_nocroak(aTHX_ input, len, pos, inner) != 0)) { |
0 |
4 |
4 |
|
| 104 |
0 |
| return -3; |
| 105 |
|
| } |
| 106 |
|
| |
| 107 |
5 |
▶ | } else if (output->type_id == CC_TYPE_UDT) { |
Branch: 1 branch
| Branch | True | False | Total |
| } else if (output->type_id == CC_TYPE_UDT) { |
2 |
3 |
5 |
|
| 108 |
|
| char *str; |
| 109 |
|
| STRLEN str_len; |
| 110 |
|
| uint16_t field_count; |
| 111 |
|
| int i; |
| 112 |
|
| |
| 113 |
2 |
| Newxz(output->udt, 1, struct cc_udt); |
| 114 |
|
| |
| 115 |
2 |
▶ | if (UNLIKELY(unpack_string_nocroak(aTHX_ input, len, pos, &str, &str_len) != 0)) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (UNLIKELY(unpack_string_nocroak(aTHX_ input, len, pos, &str, &str_len) != 0)) { |
0 |
2 |
2 |
|
| 116 |
0 |
| return -3; |
| 117 |
|
| } |
| 118 |
2 |
| output->udt->keyspace = newSVpvn_utf8(str, str_len, 1); |
| 119 |
|
| |
| 120 |
2 |
▶ | if (UNLIKELY(unpack_string_nocroak(aTHX_ input, len, pos, &str, &str_len) != 0)) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (UNLIKELY(unpack_string_nocroak(aTHX_ input, len, pos, &str, &str_len) != 0)) { |
0 |
2 |
2 |
|
| 121 |
0 |
| return -3; |
| 122 |
|
| } |
| 123 |
2 |
| output->udt->udt_name = newSVpvn_utf8(str, str_len, 1); |
| 124 |
|
| |
| 125 |
2 |
▶ | if (UNLIKELY(unpack_short_nocroak(aTHX_ input, len, pos, &field_count) != 0)) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (UNLIKELY(unpack_short_nocroak(aTHX_ input, len, pos, &field_count) != 0)) { |
0 |
2 |
2 |
|
| 126 |
0 |
| return -3; |
| 127 |
|
| } |
| 128 |
2 |
| output->udt->field_count = field_count; |
| 129 |
|
| |
| 130 |
2 |
▶ | if (UNLIKELY(field_count > len || field_count == 0)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (UNLIKELY(field_count > len || field_count == 0)) { |
2 |
0 |
2 |
| if (UNLIKELY(field_count > len || field_count == 0)) { |
0 |
2 |
2 |
|
| 131 |
0 |
| return -3; |
| 132 |
|
| } |
| 133 |
|
| |
| 134 |
2 |
| Newxz(output->udt->fields, field_count, struct cc_udt_field); |
| 135 |
|
| |
| 136 |
4 |
▶ | for (i = 0; i < field_count; i++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 0; i < field_count; i++) { |
2 |
2 |
4 |
|
| 137 |
2 |
| struct cc_udt_field *field = &output->udt->fields[i]; |
| 138 |
2 |
▶ | if (UNLIKELY(unpack_string_nocroak(aTHX_ input, len, pos, &str, &str_len) != 0)) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (UNLIKELY(unpack_string_nocroak(aTHX_ input, len, pos, &str, &str_len) != 0)) { |
0 |
2 |
2 |
|
| 139 |
0 |
| return -3; |
| 140 |
|
| } |
| 141 |
2 |
| field->name = newSVpvn_utf8(str, str_len, 1); |
| 142 |
2 |
▶ | PERL_HASH(field->name_hash, str, str_len); |
Branch: 1 branch
| Branch | True | False | Total |
| PERL_HASH(field->name_hash, str, str_len); |
2 |
0 |
2 |
|
| 143 |
|
| |
| 144 |
2 |
▶ | if (UNLIKELY(unpack_type_nocroak(aTHX_ input, len, pos, &field->type) != 0)) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (UNLIKELY(unpack_type_nocroak(aTHX_ input, len, pos, &field->type) != 0)) { |
0 |
2 |
2 |
|
| 145 |
0 |
| return -3; |
| 146 |
|
| } |
| 147 |
|
| } |
| 148 |
|
| |
| 149 |
3 |
▶ | } else if (output->type_id == CC_TYPE_TUPLE) { |
Branch: 1 branch
| Branch | True | False | Total |
| } else if (output->type_id == CC_TYPE_TUPLE) { |
3 |
0 |
3 |
|
| 150 |
|
| uint16_t field_count; |
| 151 |
|
| int i; |
| 152 |
|
| |
| 153 |
3 |
| Newxz(output->tuple, 1, struct cc_tuple); |
| 154 |
|
| |
| 155 |
3 |
▶ | if (UNLIKELY(unpack_short_nocroak(aTHX_ input, len, pos, &field_count) != 0)) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (UNLIKELY(unpack_short_nocroak(aTHX_ input, len, pos, &field_count) != 0)) { |
0 |
3 |
3 |
|
| 156 |
0 |
| return -3; |
| 157 |
|
| } |
| 158 |
3 |
| output->tuple->field_count = field_count; |
| 159 |
|
| |
| 160 |
3 |
▶ | if (UNLIKELY(field_count > len || field_count == 0)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (UNLIKELY(field_count > len || field_count == 0)) { |
3 |
0 |
3 |
| if (UNLIKELY(field_count > len || field_count == 0)) { |
0 |
3 |
3 |
|
| 161 |
0 |
| return -3; |
| 162 |
|
| } |
| 163 |
|
| |
| 164 |
3 |
| Newxz(output->tuple->fields, field_count, struct cc_type); |
| 165 |
|
| |
| 166 |
9 |
▶ | for (i = 0; i < field_count; i++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 0; i < field_count; i++) { |
6 |
3 |
9 |
|
| 167 |
|
| struct cc_type *field; |
| 168 |
6 |
| field = &output->tuple->fields[i]; |
| 169 |
|
| |
| 170 |
6 |
▶ | if (UNLIKELY(unpack_type_nocroak(aTHX_ input, len, pos, field) != 0)) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (UNLIKELY(unpack_type_nocroak(aTHX_ input, len, pos, field) != 0)) { |
0 |
6 |
6 |
|
| 171 |
0 |
| return -3; |
| 172 |
|
| } |
| 173 |
|
| } |
| 174 |
|
| |
| 175 |
|
| } else { |
| 176 |
0 |
| return -2; |
| 177 |
|
| } |
| 178 |
|
| |
| 179 |
350 |
| return 0; |
| 180 |
|
| } |
| 181 |
|
| |
| 182 |
311 |
| void unpack_type(pTHX_ unsigned char *input, STRLEN len, STRLEN *pos, struct cc_type *output) |
| 183 |
|
| { |
| 184 |
311 |
▶ | if (UNLIKELY(unpack_type_nocroak(aTHX_ input, len, pos, output) != 0)) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (UNLIKELY(unpack_type_nocroak(aTHX_ input, len, pos, output) != 0)) { |
0 |
311 |
311 |
|
| 185 |
0 |
| cc_type_destroy(aTHX_ output); |
| 186 |
0 |
| croak("unpack_type: invalid input. Data corrupted?"); |
| 187 |
|
| } |
| 188 |
311 |
| } |
| 189 |
|
| |
| 190 |
350 |
| void cc_type_destroy(pTHX_ struct cc_type *type) |
| 191 |
|
| { |
| 192 |
350 |
▶ | if (type->type_id == CC_TYPE_LIST || type->type_id == CC_TYPE_SET) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (type->type_id == CC_TYPE_LIST || type->type_id == CC_TYPE_SET) { |
341 |
9 |
350 |
| if (type->type_id == CC_TYPE_LIST || type->type_id == CC_TYPE_SET) { |
4 |
337 |
341 |
|
| 193 |
13 |
▶ | if (type->inner_type != NULL) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (type->inner_type != NULL) { |
13 |
0 |
13 |
|
| 194 |
13 |
| cc_type_destroy(aTHX_ type->inner_type); |
| 195 |
13 |
| Safefree(type->inner_type); |
| 196 |
13 |
| type->inner_type = NULL; |
| 197 |
|
| } |
| 198 |
|
| |
| 199 |
337 |
▶ | } else if (type->type_id == CC_TYPE_MAP) { |
Branch: 1 branch
| Branch | True | False | Total |
| } else if (type->type_id == CC_TYPE_MAP) { |
9 |
328 |
337 |
|
| 200 |
9 |
▶ | if (type->inner_type != NULL) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (type->inner_type != NULL) { |
9 |
0 |
9 |
|
| 201 |
9 |
| cc_type_destroy(aTHX_ &type->inner_type[0]); |
| 202 |
9 |
| cc_type_destroy(aTHX_ &type->inner_type[1]); |
| 203 |
9 |
| Safefree(type->inner_type); |
| 204 |
9 |
| type->inner_type = NULL; |
| 205 |
|
| } |
| 206 |
|
| |
| 207 |
328 |
▶ | } else if (type->type_id == CC_TYPE_CUSTOM) { |
Branch: 1 branch
| Branch | True | False | Total |
| } else if (type->type_id == CC_TYPE_CUSTOM) { |
4 |
324 |
328 |
|
| 208 |
4 |
▶ | if (type->custom_name != NULL) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (type->custom_name != NULL) { |
4 |
0 |
4 |
|
| 209 |
4 |
| Safefree(type->custom_name); |
| 210 |
4 |
| type->custom_name = NULL; |
| 211 |
|
| } |
| 212 |
|
| |
| 213 |
324 |
▶ | } else if (type->type_id == CC_TYPE_UDT) { |
Branch: 1 branch
| Branch | True | False | Total |
| } else if (type->type_id == CC_TYPE_UDT) { |
2 |
322 |
324 |
|
| 214 |
2 |
▶ | if (type->udt != NULL) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (type->udt != NULL) { |
2 |
0 |
2 |
|
| 215 |
2 |
| SvREFCNT_dec(type->udt->keyspace); |
| 216 |
2 |
| SvREFCNT_dec(type->udt->udt_name); |
| 217 |
2 |
▶ | if (type->udt->fields != NULL) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (type->udt->fields != NULL) { |
2 |
0 |
2 |
|
| 218 |
|
| int i; |
| 219 |
4 |
▶ | for (i = 0; i < type->udt->field_count; i++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 0; i < type->udt->field_count; i++) { |
2 |
2 |
4 |
|
| 220 |
2 |
| SvREFCNT_dec(type->udt->fields[i].name); |
| 221 |
2 |
| cc_type_destroy(aTHX_ &type->udt->fields[i].type); |
| 222 |
|
| } |
| 223 |
2 |
| Safefree(type->udt->fields); |
| 224 |
|
| } |
| 225 |
2 |
| Safefree(type->udt); |
| 226 |
2 |
| type->udt = NULL; |
| 227 |
|
| } |
| 228 |
|
| |
| 229 |
322 |
▶ | } else if (type->type_id == CC_TYPE_TUPLE) { |
Branch: 1 branch
| Branch | True | False | Total |
| } else if (type->type_id == CC_TYPE_TUPLE) { |
3 |
319 |
322 |
|
| 230 |
3 |
▶ | if (type->tuple != NULL) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (type->tuple != NULL) { |
3 |
0 |
3 |
|
| 231 |
3 |
▶ | if (type->tuple->fields != NULL) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (type->tuple->fields != NULL) { |
3 |
0 |
3 |
|
| 232 |
|
| int i; |
| 233 |
9 |
▶ | for (i = 0; i < type->tuple->field_count; i++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 0; i < type->tuple->field_count; i++) { |
6 |
3 |
9 |
|
| 234 |
6 |
| cc_type_destroy(aTHX_ &type->tuple->fields[i]); |
| 235 |
|
| } |
| 236 |
3 |
| Safefree(type->tuple->fields); |
| 237 |
|
| } |
| 238 |
|
| |
| 239 |
3 |
| Safefree(type->tuple); |
| 240 |
3 |
| type->tuple = NULL; |
| 241 |
|
| } |
| 242 |
|
| } |
| 243 |
350 |
| } |