summaryrefslogtreecommitdiffstats
path: root/list.c
diff options
context:
space:
mode:
authorMichael Bestas <mkbestas@lineageos.org>2019-09-29 23:59:05 +0300
committerMichael Bestas <mkbestas@lineageos.org>2019-10-23 01:12:56 +0300
commit420f26552469aa8b98692c27de2320a9c1c5dbc2 (patch)
tree31388c8e259c3d606b033c8ec19d40a1a36fdeca /list.c
parent434acc2ab4bab9d2407e5167be1dc2c22bfead0f (diff)
downloadvendor_qcom_opensource_power-420f26552469aa8b98692c27de2320a9c1c5dbc2.tar.gz
vendor_qcom_opensource_power-420f26552469aa8b98692c27de2320a9c1c5dbc2.tar.bz2
vendor_qcom_opensource_power-420f26552469aa8b98692c27de2320a9c1c5dbc2.zip
power: clang-format
* Using AOSP interface .clang-format * Clean Android.mk while we are at it Change-Id: I630f72e3dffb676ca1930e72945e897f62103ada
Diffstat (limited to 'list.c')
-rw-r--r--list.c42
1 files changed, 16 insertions, 26 deletions
diff --git a/list.c b/list.c
index 7b9e4d3..d1cceaf 100644
--- a/list.c
+++ b/list.c
@@ -31,23 +31,20 @@
#include <stdlib.h>
#include <string.h>
-#include "list.h"
#include <log/log.h>
+#include "list.h"
-int init_list_head(struct list_node *head)
-{
- if (head == NULL)
- return -1;
+int init_list_head(struct list_node* head) {
+ if (head == NULL) return -1;
memset(head, 0, sizeof(*head));
return 0;
}
-struct list_node *add_list_node(struct list_node *head, void *data)
-{
+struct list_node* add_list_node(struct list_node* head, void* data) {
/* Create a new list_node. And put 'data' into it. */
- struct list_node *new_node;
+ struct list_node* new_node;
if (head == NULL) {
return NULL;
@@ -66,18 +63,16 @@ struct list_node *add_list_node(struct list_node *head, void *data)
return new_node;
}
-int is_list_empty(struct list_node *head)
-{
+int is_list_empty(struct list_node* head) {
return (head == NULL || head->next == NULL);
}
/*
* Delink and de-allocate 'node'.
*/
-int remove_list_node(struct list_node *head, struct list_node *del_node)
-{
- struct list_node *current_node;
- struct list_node *saved_node;
+int remove_list_node(struct list_node* head, struct list_node* del_node) {
+ struct list_node* current_node;
+ struct list_node* saved_node;
if (head == NULL || head->next == NULL) {
return -1;
@@ -107,12 +102,10 @@ int remove_list_node(struct list_node *head, struct list_node *del_node)
return 0;
}
-void dump_list(struct list_node *head)
-{
- struct list_node *current_node = head;
+void dump_list(struct list_node* head) {
+ struct list_node* current_node = head;
- if (head == NULL)
- return;
+ if (head == NULL) return;
ALOGV("List:\n");
@@ -123,17 +116,14 @@ void dump_list(struct list_node *head)
}
}
-struct list_node *find_node(struct list_node *head, void *comparison_data)
-{
- struct list_node *current_node = head;
+struct list_node* find_node(struct list_node* head, void* comparison_data) {
+ struct list_node* current_node = head;
- if (head == NULL)
- return NULL;
+ if (head == NULL) return NULL;
while ((current_node = current_node->next)) {
if (current_node->compare) {
- if (current_node->compare(current_node->data,
- comparison_data) == 0) {
+ if (current_node->compare(current_node->data, comparison_data) == 0) {
/* Match found. Return current_node. */
return current_node;
}