diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-12-19 23:01:03 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-12-19 23:01:03 +0000 |
commit | 194fa45e0f191ab5c44afe7c55472f571d69d831 (patch) | |
tree | e65f3487b3e0cd1c587eded728cd93c82fd4bec5 /src/statistics/statistics_api.c | |
parent | 3a6966e9fbd995dbdea20484d843a34f04589a9e (diff) | |
download | gnunet-194fa45e0f191ab5c44afe7c55472f571d69d831.tar.gz gnunet-194fa45e0f191ab5c44afe7c55472f571d69d831.zip |
-properly use DLL apis where appropriate
Diffstat (limited to 'src/statistics/statistics_api.c')
-rw-r--r-- | src/statistics/statistics_api.c | 36 |
1 files changed, 11 insertions, 25 deletions
diff --git a/src/statistics/statistics_api.c b/src/statistics/statistics_api.c index c30279e71..2838b7060 100644 --- a/src/statistics/statistics_api.c +++ b/src/statistics/statistics_api.c | |||
@@ -856,7 +856,6 @@ GNUNET_STATISTICS_destroy (struct GNUNET_STATISTICS_Handle *h, int sync_first) | |||
856 | { | 856 | { |
857 | struct GNUNET_STATISTICS_GetHandle *pos; | 857 | struct GNUNET_STATISTICS_GetHandle *pos; |
858 | struct GNUNET_STATISTICS_GetHandle *next; | 858 | struct GNUNET_STATISTICS_GetHandle *next; |
859 | struct GNUNET_STATISTICS_GetHandle *prev; | ||
860 | struct GNUNET_TIME_Relative timeout; | 859 | struct GNUNET_TIME_Relative timeout; |
861 | int i; | 860 | int i; |
862 | 861 | ||
@@ -879,36 +878,23 @@ GNUNET_STATISTICS_destroy (struct GNUNET_STATISTICS_Handle *h, int sync_first) | |||
879 | h->current = NULL; | 878 | h->current = NULL; |
880 | } | 879 | } |
881 | } | 880 | } |
882 | pos = h->action_head; | 881 | next = h->action_head; |
883 | prev = NULL; | 882 | while (NULL != (pos = next)) |
884 | while (pos != NULL) | ||
885 | { | 883 | { |
886 | next = pos->next; | 884 | next = pos->next; |
887 | if (pos->type == ACTION_GET) | 885 | if (pos->type == ACTION_GET) |
888 | { | 886 | { |
889 | if (prev == NULL) | 887 | GNUNET_CONTAINER_DLL_remove (h->action_head, |
890 | h->action_head = next; | 888 | h->action_tail, |
891 | else | 889 | pos); |
892 | prev->next = next; | ||
893 | free_action_item (pos); | 890 | free_action_item (pos); |
894 | } | 891 | } |
895 | else | ||
896 | { | ||
897 | prev = pos; | ||
898 | } | ||
899 | pos = next; | ||
900 | } | ||
901 | h->action_tail = prev; | ||
902 | if (h->current == NULL) | ||
903 | { | ||
904 | h->current = h->action_head; | ||
905 | if (h->action_head != NULL) | ||
906 | { | ||
907 | h->action_head = h->action_head->next; | ||
908 | if (h->action_head == NULL) | ||
909 | h->action_tail = NULL; | ||
910 | } | ||
911 | } | 892 | } |
893 | if ( (NULL == h->current) && | ||
894 | (NULL != (h->current = h->action_head)) ) | ||
895 | GNUNET_CONTAINER_DLL_remove (h->action_head, | ||
896 | h->action_tail, | ||
897 | h->current); | ||
912 | h->do_destroy = GNUNET_YES; | 898 | h->do_destroy = GNUNET_YES; |
913 | if ((h->current != NULL) && (h->th == NULL)) | 899 | if ((h->current != NULL) && (h->th == NULL)) |
914 | { | 900 | { |
@@ -928,7 +914,7 @@ GNUNET_STATISTICS_destroy (struct GNUNET_STATISTICS_Handle *h, int sync_first) | |||
928 | } | 914 | } |
929 | } | 915 | } |
930 | if (h->th != NULL) | 916 | if (h->th != NULL) |
931 | return; | 917 | return; /* do not finish destruction just yet */ |
932 | } | 918 | } |
933 | while (NULL != (pos = h->action_head)) | 919 | while (NULL != (pos = h->action_head)) |
934 | { | 920 | { |