[Replicant] [libsamsung-ril] [PATCH 12/23] samsung-ril.c: break lines over 80 characters

Denis 'GNUtoo' Carikli GNUtoo at cyberdimension.org
Thu Mar 4 12:42:39 UTC 2021


Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo at cyberdimension.org>
---
 samsung-ril.c | 111 ++++++++++++++++++++++++++++++++++----------------
 1 file changed, 75 insertions(+), 36 deletions(-)

diff --git a/samsung-ril.c b/samsung-ril.c
index 6378c23..faec338 100644
--- a/samsung-ril.c
+++ b/samsung-ril.c
@@ -208,8 +208,8 @@ struct ipc_dispatch_handler ipc_fmt_dispatch_handlers[] = {
 	},
 };
 
-unsigned int ipc_fmt_dispatch_handlers_count = sizeof(ipc_fmt_dispatch_handlers) /
-	sizeof(struct ipc_dispatch_handler);
+unsigned int ipc_fmt_dispatch_handlers_count =
+	sizeof(ipc_fmt_dispatch_handlers) / sizeof(struct ipc_dispatch_handler);
 
 struct ipc_dispatch_handler ipc_rfs_dispatch_handlers[] = {
 	{
@@ -222,8 +222,8 @@ struct ipc_dispatch_handler ipc_rfs_dispatch_handlers[] = {
 	},
 };
 
-unsigned int ipc_rfs_dispatch_handlers_count = sizeof(ipc_rfs_dispatch_handlers) /
-	sizeof(struct ipc_dispatch_handler);
+unsigned int ipc_rfs_dispatch_handlers_count =
+	sizeof(ipc_rfs_dispatch_handlers) / sizeof(struct ipc_dispatch_handler);
 
 struct srs_dispatch_handler srs_dispatch_handlers[] = {
 	{
@@ -520,7 +520,9 @@ list_continue:
 		list = list->next;
 	}
 
-	RIL_LOGD("%d RIL request%s in the queue (%d pending, %d handled, %d unhandled)", count, count > 1 ? "s" : "", pending, handled, unhandled);
+	RIL_LOGD("%d RIL request%s in the queue"
+		 " (%d pending, %d handled, %d unhandled)",
+		 count, count > 1 ? "s" : "", pending, handled, unhandled);
 
 	count = 0;
 
@@ -532,7 +534,8 @@ list_continue:
 	}
 
 	if (count > 0)
-		RIL_LOGD("%d RIL request%s data in the queue", count, count > 1 ? "s" : "");
+		RIL_LOGD("%d RIL request%s data in the queue", count,
+			 count > 1 ? "s" : "");
 
 	RIL_REQUEST_UNLOCK();
 
@@ -551,7 +554,8 @@ int ril_request_register(int request, void *data, size_t size, RIL_Token token)
 
 	RIL_REQUEST_LOCK();
 
-	ril_request = (struct ril_request *) calloc(1, sizeof(struct ril_request));
+	ril_request = (struct ril_request *) calloc(1,
+						    sizeof(struct ril_request));
 	ril_request->request = request;
 	ril_request->data = NULL;
 	ril_request->size = size;
@@ -598,7 +602,8 @@ int ril_request_unregister(struct ril_request *request)
 		if (ril_clients[i] == NULL)
 			continue;
 
-		ril_client_request_unregister(ril_clients[i], request->request, request->token);
+		ril_client_request_unregister(ril_clients[i], request->request,
+					      request->token);
 	}
 
 	list = ril_data->requests;
@@ -710,7 +715,8 @@ struct ril_request *ril_request_find_request_status(int request, int status)
 
 		ril_request = (struct ril_request *) list->data;
 
-		if (ril_request->request == request && ril_request->status == status) {
+		if (ril_request->request == request &&
+		    ril_request->status == status) {
 			RIL_REQUEST_UNLOCK();
 			return ril_request;
 		}
@@ -822,7 +828,8 @@ int ril_request_complete(RIL_Token token, RIL_Errno error, void *data,
 {
 	struct ril_request *request;
 
-	if (ril_data == NULL || ril_data->env == NULL || ril_data->env->OnRequestComplete == NULL)
+	if (ril_data == NULL || ril_data->env == NULL ||
+	    ril_data->env->OnRequestComplete == NULL)
 		return -1;
 
 	if (token == NULL)
@@ -846,7 +853,8 @@ complete:
 
 int ril_request_unsolicited(int request, void *data, size_t size)
 {
-	if (ril_data == NULL || ril_data->env == NULL || ril_data->env->OnUnsolicitedResponse == NULL)
+	if (ril_data == NULL || ril_data->env == NULL ||
+	    ril_data->env->OnUnsolicitedResponse == NULL)
 		return -1;
 
 	ril_data->env->OnUnsolicitedResponse(request, data, size);
@@ -857,7 +865,8 @@ int ril_request_unsolicited(int request, void *data, size_t size)
 int ril_request_timed_callback(RIL_TimedCallback callback, void *data,
 	const struct timeval *time)
 {
-	if (ril_data == NULL || ril_data->env == NULL || ril_data->env->RequestTimedCallback == NULL)
+	if (ril_data == NULL || ril_data->env == NULL ||
+	    ril_data->env->RequestTimedCallback == NULL)
 		return -1;
 
 	ril_data->env->RequestTimedCallback(callback, data, time);
@@ -878,7 +887,8 @@ int ril_request_dispatch(struct ril_request *request)
 			continue;
 
 		if (ril_request_handlers[i].request == request->request) {
-			status = ril_request_handlers[i].handler(request->data, request->size, request->token);
+			status = ril_request_handlers[i].handler(
+				request->data, request->size, request->token);
 			switch (status) {
 				case RIL_REQUEST_PENDING:
 				case RIL_REQUEST_HANDLED:
@@ -888,7 +898,10 @@ int ril_request_dispatch(struct ril_request *request)
 				case RIL_REQUEST_COMPLETED:
 					break;
 				default:
-					RIL_LOGE("Handling RIL request %d failed", request->request);
+					RIL_LOGE(
+						"Handling RIL request %d"
+						" failed",
+						request->request);
 					return -1;
 			}
 
@@ -897,7 +910,8 @@ int ril_request_dispatch(struct ril_request *request)
 	}
 
 	RIL_LOGD("Unhandled RIL request: %d", request->request);
-	ril_request_complete(request->token, RIL_E_REQUEST_NOT_SUPPORTED, NULL, 0);
+	ril_request_complete(request->token, RIL_E_REQUEST_NOT_SUPPORTED, NULL,
+			     0);
 
 	return 0;
 }
@@ -922,7 +936,8 @@ void *ril_request_loop(__attribute__((unused)) void *data)
 		}
 
 		do {
-			request = ril_request_find_status(RIL_REQUEST_UNHANDLED);
+			request = ril_request_find_status(
+				RIL_REQUEST_UNHANDLED);
 			if (request == NULL)
 				break;
 
@@ -958,7 +973,8 @@ int ril_request_data_register(int request, void *data, size_t size)
 	if (data == NULL || ril_data == NULL)
 		return -1;
 
-	request_data = (struct ril_request_data *) calloc(1, sizeof(struct ril_request_data));
+	request_data = (struct ril_request_data *) calloc(
+		1, sizeof(struct ril_request_data));
 	request_data->request = request;
 	request_data->data = data;
 	request_data->size = size;
@@ -985,7 +1001,8 @@ int ril_request_data_unregister(struct ril_request_data *request_data)
 	list = ril_data->requests_data;
 	while (list != NULL) {
 		if (list->data == (void *) request_data) {
-			memset(request_data, 0, sizeof(struct ril_request_data));
+			memset(request_data, 0,
+			       sizeof(struct ril_request_data));
 			free(request_data);
 
 			if (list == ril_data->requests_data)
@@ -1016,10 +1033,12 @@ int ril_request_data_flush(void)
 		if (list->data != NULL) {
 			request_data = (struct ril_request_data *) list->data;
 
-			if (request_data->data != NULL && request_data->size > 0)
+			if (request_data->data != NULL &&
+			    request_data->size > 0)
 				free(request_data->data);
 
-			memset(request_data, 0, sizeof(struct ril_request_data));
+			memset(request_data, 0,
+			       sizeof(struct ril_request_data));
 			free(request_data);
 		}
 
@@ -1155,7 +1174,8 @@ int ril_radio_state_update(RIL_RadioState radio_state)
 	RIL_LOGD("Updating RIL radio state to %d", radio_state);
 
 	ril_data->radio_state = radio_state;
-	ril_request_unsolicited(RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED, NULL, 0);
+	ril_request_unsolicited(RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED, NULL,
+				0);
 
 	switch (ril_data->radio_state) {
 		case RADIO_STATE_UNAVAILABLE:
@@ -1164,7 +1184,10 @@ int ril_radio_state_update(RIL_RadioState radio_state)
 				if (request == NULL)
 					break;
 
-				ril_request_complete(request->token, RIL_E_RADIO_NOT_AVAILABLE, NULL, 0);
+				ril_request_complete(request->token,
+						     RIL_E_RADIO_NOT_AVAILABLE,
+						     NULL,
+						     0);
 
 				ril_request_unregister(request);
 			} while (request != NULL);
@@ -1183,10 +1206,15 @@ int ril_radio_state_update(RIL_RadioState radio_state)
 		case RADIO_STATE_OFF:
 			ril_data_connection_flush();
 
-			ril_request_unsolicited(RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED, NULL, 0);
-			ril_request_unsolicited(RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED, NULL, 0);
-			ril_request_unsolicited(RIL_UNSOL_DATA_CALL_LIST_CHANGED, NULL, 0);
-			ril_request_unsolicited(RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED, NULL, 0);
+			ril_request_unsolicited(
+				RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED, NULL, 0);
+			ril_request_unsolicited(
+				RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED,
+				NULL, 0);
+			ril_request_unsolicited(
+				RIL_UNSOL_DATA_CALL_LIST_CHANGED, NULL, 0);
+			ril_request_unsolicited(
+				RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED, NULL, 0);
 			break;
 		default:
 			RIL_REQUEST_LOOP_UNLOCK();
@@ -1339,7 +1367,8 @@ void ril_on_request(int request, void *data, size_t size, RIL_Token token)
 			memcpy(buffer, data, size);
 
 			if (((RIL_Dial *) data)->address != NULL)
-				((RIL_Dial *) buffer)->address = strdup(((RIL_Dial *) data)->address);
+				((RIL_Dial *) buffer)->address = strdup(
+					((RIL_Dial *) data)->address);
 
 			data = buffer;
 			break;
@@ -1353,10 +1382,12 @@ void ril_on_request(int request, void *data, size_t size, RIL_Token token)
 			memcpy(buffer, data, size);
 
 			if (((RIL_SMS_WriteArgs *) data)->pdu != NULL)
-				((RIL_SMS_WriteArgs *) buffer)->pdu = strdup(((RIL_SMS_WriteArgs *) data)->pdu);
+				((RIL_SMS_WriteArgs *) buffer)->pdu = strdup(
+					((RIL_SMS_WriteArgs *) data)->pdu);
 
 			if (((RIL_SMS_WriteArgs *) data)->smsc != NULL)
-				((RIL_SMS_WriteArgs *) buffer)->smsc = strdup(((RIL_SMS_WriteArgs *) data)->smsc);
+				((RIL_SMS_WriteArgs *) buffer)->smsc = strdup(
+					((RIL_SMS_WriteArgs *) data)->smsc);
 
 			data = buffer;
 			break;
@@ -1381,16 +1412,20 @@ void ril_on_request(int request, void *data, size_t size, RIL_Token token)
 			memcpy(buffer, data, size);
 
 			if (((RIL_SIM_IO_compat *) data)->path != NULL)
-				((RIL_SIM_IO_compat *) buffer)->path = strdup(((RIL_SIM_IO_compat *) data)->path);
+				((RIL_SIM_IO_compat *) buffer)->path = strdup(
+					((RIL_SIM_IO_compat *) data)->path);
 
 			if (((RIL_SIM_IO_compat *) data)->data != NULL)
-				((RIL_SIM_IO_compat *) buffer)->data = strdup(((RIL_SIM_IO_compat *) data)->data);
+				((RIL_SIM_IO_compat *) buffer)->data = strdup(
+					((RIL_SIM_IO_compat *) data)->data);
 
 			if (((RIL_SIM_IO_compat *) data)->pin2 != NULL)
-				((RIL_SIM_IO_compat *) buffer)->pin2 = strdup(((RIL_SIM_IO_compat *) data)->pin2);
+				((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);
+				((RIL_SIM_IO_compat *) buffer)->aidPtr = strdup
+					(((RIL_SIM_IO_compat *) data)->aidPtr);
 #endif
 
 			data = buffer;
@@ -1409,13 +1444,16 @@ void ril_on_request(int request, void *data, size_t size, RIL_Token token)
 
 			if (i > 0 && c[i] == '\0') {
 				size = i + 1;
-				RIL_LOGD("Detected string with a size of %d byte%s", size, size > 0 ? "s" : "");
+				RIL_LOGD("Detected string with a size of %d "
+					 "byte%s",
+					 size, size > 0 ? "s" : "");
 			}
 
 			break;
 	}
 
-	if (strings_count > 0 && data != NULL && size >= strings_count * sizeof(char *)) {
+	if (strings_count > 0 && data != NULL &&
+	    size >= strings_count * sizeof(char *)) {
 		buffer = calloc(1, size);
 
 		for (i = 0; i < strings_count; i++) {
@@ -1554,7 +1592,8 @@ const RIL_RadioFunctions *RIL_Init(const struct RIL_Env *env,
 	pthread_attr_init(&attr);
 	pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
 
-	rc = pthread_create(&ril_data->request_thread, &attr, ril_request_loop, NULL);
+	rc = pthread_create(&ril_data->request_thread, &attr, ril_request_loop,
+			    NULL);
 	if (rc != 0) {
 		RIL_LOGE("Starting request loop failed");
 		goto error;
-- 
2.30.1



More information about the Replicant mailing list