Skip to content

Instantly share code, notes, and snippets.

@kaworu
Created March 8, 2013 15:43
Show Gist options
  • Save kaworu/5117338 to your computer and use it in GitHub Desktop.
Save kaworu/5117338 to your computer and use it in GitHub Desktop.
gcc48 pkgng patch
diff --git a/libpkg/private/pkg.h b/libpkg/private/pkg.h
index f6ad119..a92fdcf 100644
--- a/libpkg/private/pkg.h
+++ b/libpkg/private/pkg.h
@@ -70,8 +70,7 @@
struct type *hf1, *hf2; \
HASH_ITER(hh, data, hf1, hf2) { \
HASH_DEL(data, hf1); \
- if (free_func != NULL) \
- free_func(hf1); \
+ free_func(hf1); \
} \
data = NULL; \
} while (0)
@@ -80,8 +79,7 @@
struct type *l1, *l2; \
LL_FOREACH_SAFE(head, l1, l2) { \
LL_DELETE(head, l1); \
- if (free_func != NULL) \
- free_func(l1); \
+ free_func(l1); \
} \
head = NULL; \
} while (0)
@kaworu
Copy link
Author

kaworu commented Mar 8, 2013

GCC complains that the test (free_func != NULL) is always true and it is right, but removing this part we actually lose some functionality. On the other hand, reverting this patch when a case with free_func == NULL will arise is gonna be easy.

I dislike this patch a lot, maybe we should find a way to prevent GCC to complain about this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment