Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make make(1): indent list functions with tabs instea...



details:   https://anonhg.NetBSD.org/src/rev/12eae992443b
branches:  trunk
changeset: 1016586:12eae992443b
user:      rillig <rillig%NetBSD.org@localhost>
date:      Tue Nov 24 19:46:29 2020 +0000

description:
make(1): indent list functions with tabs instead of spaces

diffstat:

 usr.bin/make/lst.c |  230 ++++++++++++++++++++++++++--------------------------
 usr.bin/make/lst.h |   39 ++++----
 2 files changed, 137 insertions(+), 132 deletions(-)

diffs (truncated from 474 to 300 lines):

diff -r 6331a5e22bce -r 12eae992443b usr.bin/make/lst.c
--- a/usr.bin/make/lst.c        Tue Nov 24 19:33:13 2020 +0000
+++ b/usr.bin/make/lst.c        Tue Nov 24 19:46:29 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lst.c,v 1.92 2020/11/08 01:29:26 rillig Exp $ */
+/* $NetBSD: lst.c,v 1.93 2020/11/24 19:46:29 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -34,42 +34,44 @@
 
 #include "make.h"
 
-MAKE_RCSID("$NetBSD: lst.c,v 1.92 2020/11/08 01:29:26 rillig Exp $");
+MAKE_RCSID("$NetBSD: lst.c,v 1.93 2020/11/24 19:46:29 rillig Exp $");
 
 static ListNode *
 LstNodeNew(ListNode *prev, ListNode *next, void *datum)
 {
-    ListNode *ln = bmake_malloc(sizeof *ln);
-    ln->prev = prev;
-    ln->next = next;
-    ln->datum = datum;
-    return ln;
+       ListNode *ln = bmake_malloc(sizeof *ln);
+
+       ln->prev = prev;
+       ln->next = next;
+       ln->datum = datum;
+
+       return ln;
 }
 
 /* Create and initialize a new, empty list. */
 List *
 Lst_New(void)
 {
-    List *list = bmake_malloc(sizeof *list);
+       List *list = bmake_malloc(sizeof *list);
 
-    list->first = NULL;
-    list->last = NULL;
+       list->first = NULL;
+       list->last = NULL;
 
-    return list;
+       return list;
 }
 
 /* Free a list and all its nodes. The node data are not freed though. */
 void
 Lst_Free(List *list)
 {
-    ListNode *ln, *next;
+       ListNode *ln, *next;
 
-    for (ln = list->first; ln != NULL; ln = next) {
-       next = ln->next;
-       free(ln);
-    }
+       for (ln = list->first; ln != NULL; ln = next) {
+               next = ln->next;
+               free(ln);
+       }
 
-    free(list);
+       free(list);
 }
 
 /* Destroy a list and free all its resources. The freeProc is called with the
@@ -77,71 +79,71 @@
 void
 Lst_Destroy(List *list, LstFreeProc freeProc)
 {
-    ListNode *ln, *next;
+       ListNode *ln, *next;
 
-    for (ln = list->first; ln != NULL; ln = next) {
-       next = ln->next;
-       freeProc(ln->datum);
-       free(ln);
-    }
+       for (ln = list->first; ln != NULL; ln = next) {
+               next = ln->next;
+               freeProc(ln->datum);
+               free(ln);
+       }
 
-    free(list);
+       free(list);
 }
 
 /* Insert a new node with the datum before the given node. */
 void
 Lst_InsertBefore(List *list, ListNode *ln, void *datum)
 {
-    ListNode *newNode;
+       ListNode *newNode;
 
-    assert(datum != NULL);
+       assert(datum != NULL);
 
-    newNode = LstNodeNew(ln->prev, ln, datum);
+       newNode = LstNodeNew(ln->prev, ln, datum);
 
-    if (ln->prev != NULL)
-       ln->prev->next = newNode;
-    ln->prev = newNode;
+       if (ln->prev != NULL)
+               ln->prev->next = newNode;
+       ln->prev = newNode;
 
-    if (ln == list->first)
-       list->first = newNode;
+       if (ln == list->first)
+               list->first = newNode;
 }
 
 /* Add a piece of data at the start of the given list. */
 void
 Lst_Prepend(List *list, void *datum)
 {
-    ListNode *ln;
+       ListNode *ln;
 
-    assert(datum != NULL);
+       assert(datum != NULL);
 
-    ln = LstNodeNew(NULL, list->first, datum);
+       ln = LstNodeNew(NULL, list->first, datum);
 
-    if (list->first == NULL) {
-       list->first = ln;
-       list->last = ln;
-    } else {
-       list->first->prev = ln;
-       list->first = ln;
-    }
+       if (list->first == NULL) {
+               list->first = ln;
+               list->last = ln;
+       } else {
+               list->first->prev = ln;
+               list->first = ln;
+       }
 }
 
 /* Add a piece of data at the end of the given list. */
 void
 Lst_Append(List *list, void *datum)
 {
-    ListNode *ln;
+       ListNode *ln;
 
-    assert(datum != NULL);
+       assert(datum != NULL);
 
-    ln = LstNodeNew(list->last, NULL, datum);
+       ln = LstNodeNew(list->last, NULL, datum);
 
-    if (list->last == NULL) {
-       list->first = ln;
-       list->last = ln;
-    } else {
-       list->last->next = ln;
-       list->last = ln;
-    }
+       if (list->last == NULL) {
+               list->first = ln;
+               list->last = ln;
+       } else {
+               list->last->next = ln;
+               list->last = ln;
+       }
 }
 
 /* Remove the given node from the given list.
@@ -149,26 +151,26 @@
 void
 Lst_Remove(List *list, ListNode *ln)
 {
-    /* unlink it from its neighbors */
-    if (ln->next != NULL)
-       ln->next->prev = ln->prev;
-    if (ln->prev != NULL)
-       ln->prev->next = ln->next;
+       /* unlink it from its neighbors */
+       if (ln->next != NULL)
+               ln->next->prev = ln->prev;
+       if (ln->prev != NULL)
+               ln->prev->next = ln->next;
 
-    /* unlink it from the list */
-    if (list->first == ln)
-       list->first = ln->next;
-    if (list->last == ln)
-       list->last = ln->prev;
+       /* unlink it from the list */
+       if (list->first == ln)
+               list->first = ln->next;
+       if (list->last == ln)
+               list->last = ln->prev;
 }
 
 /* Replace the datum in the given node with the new datum. */
 void
 LstNode_Set(ListNode *ln, void *datum)
 {
-    assert(datum != NULL);
+       assert(datum != NULL);
 
-    ln->datum = datum;
+       ln->datum = datum;
 }
 
 /* Replace the datum in the given node with NULL.
@@ -176,7 +178,7 @@
 void
 LstNode_SetNull(ListNode *ln)
 {
-    ln->datum = NULL;
+       ln->datum = NULL;
 }
 
 /* Return the first node that contains the given datum, or NULL.
@@ -185,29 +187,29 @@
 ListNode *
 Lst_FindDatum(List *list, const void *datum)
 {
-    ListNode *ln;
+       ListNode *ln;
 
-    assert(datum != NULL);
+       assert(datum != NULL);
 
-    for (ln = list->first; ln != NULL; ln = ln->next)
-       if (ln->datum == datum)
-           return ln;
+       for (ln = list->first; ln != NULL; ln = ln->next)
+               if (ln->datum == datum)
+                       return ln;
 
-    return NULL;
+       return NULL;
 }
 
 int
 Lst_ForEachUntil(List *list, LstActionUntilProc proc, void *procData)
 {
-    ListNode *ln;
-    int result = 0;
+       ListNode *ln;
+       int result = 0;
 
-    for (ln = list->first; ln != NULL; ln = ln->next) {
-       result = proc(ln->datum, procData);
-       if (result != 0)
-           break;
-    }
-    return result;
+       for (ln = list->first; ln != NULL; ln = ln->next) {
+               result = proc(ln->datum, procData);
+               if (result != 0)
+                       break;
+       }
+       return result;
 }
 
 /* Move all nodes from src to the end of dst.
@@ -215,34 +217,36 @@
 void
 Lst_MoveAll(List *dst, List *src)
 {
-    if (src->first != NULL) {
-       src->first->prev = dst->last;
-       if (dst->last != NULL)
-           dst->last->next = src->first;
-       else
-           dst->first = src->first;
+       if (src->first != NULL) {
+               src->first->prev = dst->last;
+               if (dst->last != NULL)
+                       dst->last->next = src->first;
+               else
+                       dst->first = src->first;
 
-       dst->last = src->last;
-    }
-    free(src);
+               dst->last = src->last;
+       }
+       free(src);
 }
 
 /* Copy the element data from src to the start of dst. */
 void
 Lst_PrependAll(List *dst, List *src)
 {
-    ListNode *node;
-    for (node = src->last; node != NULL; node = node->prev)



Home | Main Index | Thread Index | Old Index