From 92fcdfb56087316f253357d6fc819b2a73d428d7 Mon Sep 17 00:00:00 2001 From: Cedric Bastoul Date: Fri, 9 Dec 2011 16:34:06 +0100 Subject: [PATCH] Rename relation_list_concat_inplace to relation_list_add --- include/osl/relation_list.h | 4 ++-- source/relation_list.c | 26 +++++++++----------------- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/include/osl/relation_list.h b/include/osl/relation_list.h index 6b17a7e..8f6e157 100644 --- a/include/osl/relation_list.h +++ b/include/osl/relation_list.h @@ -118,8 +118,8 @@ osl_relation_list_p osl_relation_list_node(osl_relation_p); osl_relation_list_p osl_relation_list_clone(osl_relation_list_p); osl_relation_list_p osl_relation_list_concat(osl_relation_list_p, osl_relation_list_p); -void osl_relation_list_concat_inplace(osl_relation_list_p *, - osl_relation_list_p); +void osl_relation_list_add(osl_relation_list_p *, + osl_relation_list_p); int osl_relation_list_equal(osl_relation_list_p, osl_relation_list_p); int osl_relation_list_integrity_check(osl_relation_list_p, diff --git a/source/relation_list.c b/source/relation_list.c index 1fef89f..0fe06bd 100644 --- a/source/relation_list.c +++ b/source/relation_list.c @@ -407,27 +407,19 @@ osl_relation_list_p osl_relation_list_concat(osl_relation_list_p l1, /** - * osl_relation_list_concat_inplace function: - * this function concatenates a relation list to another. No new list is - * created: this functions links the two input lists. If the first relation - * list is NULL, it is set to the second relation list. - * two lists sent as parameters. + * osl_relation_list_add function: + * this function adds a relation list at the end of the relation list + * pointed by l1. No new list is created: this functions links the two + * input lists. If the first relation list is NULL, it is set to the + * second relation list. * \param[in,out] l1 Pointer to the first relation list. * \param[in] l2 The second relation list. */ -void osl_relation_list_concat_inplace(osl_relation_list_p *l1, - osl_relation_list_p l2) { - osl_relation_list_p temp; +void osl_relation_list_add(osl_relation_list_p *l1, osl_relation_list_p l2) { + while (*l1 != NULL) + l1 = &((*l1)->next); - if (*l1 == NULL) { - *l1 = l2; - return; - } - - temp = *l1; - while (temp->next != NULL) - temp = temp->next; - temp->next = l2; + *l1 = l2; } -- 2.11.4.GIT