aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas "Cakeisalie5" Touhey <thomas@touhey.fr>2018-03-09 22:36:15 +0100
committerThomas "Cakeisalie5" Touhey <thomas@touhey.fr>2018-03-09 22:36:15 +0100
commita13e6b0efd88f13baa76f8a7e38124d985a561c5 (patch)
treef208de5667f0ad4e5ceff61bf158c588fddef761
parent766a09d7b79378bf97eaa032c9d5fecb3b85ca1a (diff)
Debugging why remove_in_list() doesn't work.
-rwxr-xr-xMakefile2
-rw-r--r--daemon/internals.h1
-rw-r--r--daemon/list.c6
-rw-r--r--daemon/main.c15
4 files changed, 14 insertions, 10 deletions
diff --git a/Makefile b/Makefile
index 162759f..914bf0e 100755
--- a/Makefile
+++ b/Makefile
@@ -13,7 +13,7 @@
SRC_D := $(wildcard $(DIR_D)/*.c)
SRC_D := $(foreach x,$(SRC_D),$(x:$(DIR_D)/%=%))
OBJ_D := $(foreach x,$(SRC_D),$(BUILD)/$(DIR_D)/$(x:%=%.o))
- CFL_D := $(shell pkg-config libcurl --cflags)
+ CFL_D := -g $(shell pkg-config libcurl --cflags)
LIB_D := $(shell pkg-config libcurl --libs)
DIR_L := lib
diff --git a/daemon/internals.h b/daemon/internals.h
index c33dc39..474d77b 100644
--- a/daemon/internals.h
+++ b/daemon/internals.h
@@ -79,6 +79,7 @@ typedef struct wescfgsec {
/* Lors de la gestion des ressources, les ressources en elles-mêmes ne sont
* pas utilisées, ce sont en réalité leurs en-têtes (qu'elles doivent
* obligatoirement comporter).
+ *
* Ces en-têtes donnent les méta-informations concernant la ressource,
* comme le statut de celle-ci, sa position dans les deux chaînes principales,
* et l'identifiant numérique localement unique de la ressource. */
diff --git a/daemon/list.c b/daemon/list.c
index 3e96f62..beed316 100644
--- a/daemon/list.c
+++ b/daemon/list.c
@@ -67,10 +67,7 @@ int add_to_list(weslist_t *list, weshead_t *element)
* liste chaînée ou non. */
id = list->last_id;
- if (list->last)
- current = list->last;
- else
- current = &list->initial;
+ current = list->last;
while (1) {
id++;
@@ -90,6 +87,7 @@ int add_to_list(weslist_t *list, weshead_t *element)
* Ajoutons l'élément aux deux chaînes et définissons ses propriétés
* de base. */
+ element->prev = current;
element->next = current->next;
current->next = element;
if (element->next)
diff --git a/daemon/main.c b/daemon/main.c
index 1e2b67f..b13ff72 100644
--- a/daemon/main.c
+++ b/daemon/main.c
@@ -42,7 +42,6 @@ static void iterate(weslist_t *list)
addr->data.inet.ipv4[1], addr->data.inet.ipv4[2],
addr->data.inet.ipv4[3]);
}
- printf("\n");
}
static void example(weslist_t *list)
@@ -53,12 +52,18 @@ static void example(weslist_t *list)
unsigned char ip2[4] = {192, 168, 1, 4};
unsigned char ip3[4] = {192, 168, 3, 144};
- printf("%d\n", register_from_dhcpv4(list, &wes, ip1));
- printf("%d\n", register_from_dhcpv4(list, &wes, ip2));
- //printf("%d\n", register_from_dhcpv4(list, &wes, ip1));
- printf("\n");
+ printf("\n%d\n", register_from_dhcpv4(list, &wes, ip1));
+ iterate(list);
+ iterate(list);
+
+ printf("\n%d\n", register_from_dhcpv4(list, &wes, ip2));
+ iterate(list);
+ iterate(list);
+ /*
+ printf("\n%d\n", register_from_dhcpv4(list, &wes, ip1));
iterate(list);
+ */
return ;