/src/open5gs/lib/sbi/openapi/model/preemption_vulnerability.c
Line | Count | Source |
1 | | |
2 | | #include <stdlib.h> |
3 | | #include <string.h> |
4 | | #include <stdio.h> |
5 | | #include "preemption_vulnerability.h" |
6 | | |
7 | | char* OpenAPI_preemption_vulnerability_ToString(OpenAPI_preemption_vulnerability_e preemption_vulnerability) |
8 | 0 | { |
9 | 0 | const char *preemption_vulnerabilityArray[] = { "NULL", "NOT_PREEMPTABLE", "PREEMPTABLE" }; |
10 | 0 | size_t sizeofArray = sizeof(preemption_vulnerabilityArray) / sizeof(preemption_vulnerabilityArray[0]); |
11 | 0 | if (preemption_vulnerability < sizeofArray) |
12 | 0 | return (char *)preemption_vulnerabilityArray[preemption_vulnerability]; |
13 | 0 | else |
14 | 0 | return (char *)"Unknown"; |
15 | 0 | } |
16 | | |
17 | | OpenAPI_preemption_vulnerability_e OpenAPI_preemption_vulnerability_FromString(char* preemption_vulnerability) |
18 | 2.46k | { |
19 | 2.46k | int stringToReturn = 0; |
20 | 2.46k | const char *preemption_vulnerabilityArray[] = { "NULL", "NOT_PREEMPTABLE", "PREEMPTABLE" }; |
21 | 2.46k | size_t sizeofArray = sizeof(preemption_vulnerabilityArray) / sizeof(preemption_vulnerabilityArray[0]); |
22 | 8.50k | while (stringToReturn < sizeofArray) { |
23 | 7.08k | if (strcmp(preemption_vulnerability, preemption_vulnerabilityArray[stringToReturn]) == 0) { |
24 | 1.04k | return stringToReturn; |
25 | 1.04k | } |
26 | 6.03k | stringToReturn++; |
27 | 6.03k | } |
28 | 1.42k | return 0; |
29 | 2.46k | } |
30 | | |