summaryrefslogtreecommitdiffstats
path: root/samsung-ril.c
diff options
context:
space:
mode:
authorDenis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>2019-06-20 18:13:42 +0200
committerDenis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>2020-08-27 18:12:57 +0200
commitb2c262f77db00daa5e101f35bd5f2c9cfb292550 (patch)
treed57428928c1a4e3afd4620ad86d2327966d68622 /samsung-ril.c
parent2a4d669042d3ba0f1cc0b58a9015d2417e0c6b20 (diff)
downloadhardware_replicant_libsamsung-ril-b2c262f77db00daa5e101f35bd5f2c9cfb292550.tar.gz
hardware_replicant_libsamsung-ril-b2c262f77db00daa5e101f35bd5f2c9cfb292550.tar.bz2
hardware_replicant_libsamsung-ril-b2c262f77db00daa5e101f35bd5f2c9cfb292550.zip
Wrap RIL_*_v6 to reduce ifdefs
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
Diffstat (limited to 'samsung-ril.c')
-rw-r--r--samsung-ril.c36
1 files changed, 11 insertions, 25 deletions
diff --git a/samsung-ril.c b/samsung-ril.c
index a9cc224..0f829df 100644
--- a/samsung-ril.c
+++ b/samsung-ril.c
@@ -23,8 +23,8 @@
#define LOG_TAG "RIL"
#include <utils/Log.h>
-#include <telephony/ril.h>
+#include <ril-versions-compat.h>
#include <samsung-ril.h>
#include <utils.h>
@@ -1338,38 +1338,24 @@ void ril_on_request(int request, void *data, size_t size, RIL_Token token)
strings_count = size / sizeof(char *);
break;
case RIL_REQUEST_SIM_IO:
-#if RIL_VERSION >= 6
- if (data == NULL || size < sizeof(RIL_SIM_IO_v6))
-#else
- if (data == NULL || size < sizeof(RIL_SIM_IO))
-#endif
+ if (data == NULL || size < sizeof(RIL_SIM_IO_compat))
break;
buffer = calloc(1, size);
memcpy(buffer, data, size);
-#if RIL_VERSION >= 6
- if (((RIL_SIM_IO_v6 *) data)->path != NULL)
- ((RIL_SIM_IO_v6 *) buffer)->path = strdup(((RIL_SIM_IO_v6 *) data)->path);
-
- if (((RIL_SIM_IO_v6 *) data)->data != NULL)
- ((RIL_SIM_IO_v6 *) buffer)->data = strdup(((RIL_SIM_IO_v6 *) data)->data);
+ if (((RIL_SIM_IO_compat *) data)->path != NULL)
+ ((RIL_SIM_IO_compat *) buffer)->path = strdup(((RIL_SIM_IO_compat *) data)->path);
- if (((RIL_SIM_IO_v6 *) data)->pin2 != NULL)
- ((RIL_SIM_IO_v6 *) buffer)->pin2 = strdup(((RIL_SIM_IO_v6 *) data)->pin2);
+ if (((RIL_SIM_IO_compat *) data)->data != NULL)
+ ((RIL_SIM_IO_compat *) buffer)->data = strdup(((RIL_SIM_IO_compat *) data)->data);
- if (((RIL_SIM_IO_v6 *) data)->aidPtr != NULL)
- ((RIL_SIM_IO_v6 *) buffer)->aidPtr = strdup(((RIL_SIM_IO_v6 *) data)->aidPtr);
-#else
- if (((RIL_SIM_IO *) data)->path != NULL)
- ((RIL_SIM_IO *) buffer)->path = strdup(((RIL_SIM_IO *) data)->path);
-
- if (((RIL_SIM_IO *) data)->data != NULL)
- ((RIL_SIM_IO *) buffer)->data = strdup(((RIL_SIM_IO *) data)->data);
-
- if (((RIL_SIM_IO *) data)->pin2 != NULL)
- ((RIL_SIM_IO *) buffer)->pin2 = strdup(((RIL_SIM_IO *) data)->pin2);
+ if (((RIL_SIM_IO_compat *) data)->pin2 != NULL)
+ ((RIL_SIM_IO_compat *) buffer)->pin2 = strdup(((RIL_SIM_IO_compat *) data)->pin2);
+#if RIL_VERSION >= 6
+ if (((RIL_SIM_IO_compat *) data)->aidPtr != NULL)
+ ((RIL_SIM_IO_compat *) buffer)->aidPtr = strdup(((RIL_SIM_IO_compat *) data)->aidPtr);
#endif
data = buffer;