]> git.ozlabs.org Git - ccan/commitdiff
Merge remote-tracking branch 'origin/pr/48'
authorRusty Russell <rusty@rustcorp.com.au>
Tue, 30 Aug 2016 00:32:06 +0000 (10:02 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Tue, 30 Aug 2016 00:32:06 +0000 (10:02 +0930)
17 files changed:
.travis.yml
ccan/base64/base64.c
ccan/ciniparser/ciniparser.c
ccan/ciniparser/ciniparser.h
ccan/ciniparser/dictionary.c
ccan/ciniparser/dictionary.h
ccan/crypto/shachain/shachain.c
ccan/generator/test/compile_fail-4.c
ccan/pr_log/_info
ccan/strmap/LICENSE [new symlink]
ccan/tal/tal.h
ccan/tlist/_info
ccan/tlist/test/run.c
ccan/tlist/tlist.h
tools/ccan_depends.c
tools/configurator/configurator.c
tools/manifest.c

index 37bbd46032efbce420b3b5dc91e044e1b4e9f70b..cbb0aebb881c1d782b2431230be392fc55916e8c 100644 (file)
@@ -11,5 +11,6 @@ addons:
             - libjudy-dev libvorbis-dev libportaudio-dev libtalloc-dev
 
 script:
+        - make config.h
         - make -j2
         - make -j2 -k check
index 5e75dd71c5c9629f452c13504591425643fe522d..af078bc76ef5d6535b48ed15fb70e07f5f454bfa 100644 (file)
@@ -14,7 +14,6 @@
  */
 static char sixbit_to_b64(const base64_maps_t *maps, const uint8_t sixbit)
 {
-       assert(sixbit >= 0);
        assert(sixbit <= 63);
 
        return maps->encode_map[(unsigned char)sixbit];
index 2b60e409bd7ac7259d2e5245fd457e8087ed7472..527f83776e86428c5e283b76211291445ae7b4f9 100644 (file)
@@ -316,7 +316,7 @@ int ciniparser_getint(dictionary *d, const char *key, int notfound)
        return (int) strtol(str, NULL, 10);
 }
 
-double ciniparser_getdouble(dictionary *d, char *key, double notfound)
+double ciniparser_getdouble(dictionary *d, const char *key, double notfound)
 {
        char *str;
 
index f61b357627fe50582d7a212995c312e0033b4418..b61c1d6eaa48650dbe70c9de3a35c9abd0ac3cd0 100644 (file)
@@ -151,7 +151,7 @@ int ciniparser_getint(dictionary *d, const char *key, int notfound);
  * ini file is given as "section:key". If the key cannot be found,
  * the notfound value is returned.
  */
-double ciniparser_getdouble(dictionary *d, char *key, double notfound);
+double ciniparser_getdouble(dictionary *d, const char *key, double notfound);
 
 /**
  * @brief    Get the string associated to a key, convert to a boolean
index 4b24fb04484a1128cbc5bd9c7caf7295131cf80a..19dd6411cc9cceb3cabe311a079352f0836e74ed 100644 (file)
@@ -72,7 +72,7 @@ static void *mem_double(void *ptr, int size)
 
 /* The remaining exposed functions are documented in dictionary.h */
 
-unsigned dictionary_hash(char *key)
+unsigned dictionary_hash(const char *key)
 {
        int len;
        unsigned hash;
@@ -126,7 +126,7 @@ void dictionary_del(dictionary *d)
        return;
 }
 
-char *dictionary_get(dictionary *d, char *key, char *def)
+char *dictionary_get(dictionary *d, const char *key, char *def)
 {
        unsigned hash;
        int i;
@@ -146,7 +146,7 @@ char *dictionary_get(dictionary *d, char *key, char *def)
        return def;
 }
 
-int dictionary_set(dictionary *d, char *key, char *val)
+int dictionary_set(dictionary *d, const char *key, char *val)
 {
        int i;
        unsigned hash;
@@ -206,7 +206,7 @@ int dictionary_set(dictionary *d, char *key, char *val)
        return 0;
 }
 
-void dictionary_unset(dictionary *d, char *key)
+void dictionary_unset(dictionary *d, const char *key)
 {
        unsigned hash;
        int i;
index f831e39dc752086f96bfa52704c0c4493fc3ebb9..a94ea1a140e841931a95930eaf4d5d09ae4b12f2 100644 (file)
@@ -76,7 +76,7 @@ typedef struct _dictionary_ {
  * The key is stored anyway in the struct so that collision can be avoided
  * by comparing the key itself in last resort.
  */
-unsigned dictionary_hash(char *key);
+unsigned dictionary_hash(const char *key);
 
 /**
  * @brief Create a new dictionary object.
@@ -110,7 +110,7 @@ void dictionary_del(dictionary *vd);
  * dictionary. The returned character pointer points to data internal to the
  * dictionary object, you should not try to free it or modify it.
  */
-char *dictionary_get(dictionary *d, char *key, char *def);
+char *dictionary_get(dictionary *d, const char *key, char *def);
 
 /**
  * @brief Set a value in a dictionary.
@@ -136,7 +136,7 @@ char *dictionary_get(dictionary *d, char *key, char *def);
  *
  * This function returns non-zero in case of failure.
  */
-int dictionary_set(dictionary *vd, char *key, char *val);
+int dictionary_set(dictionary *vd, const char *key, char *val);
 
 /**
  * @brief Delete a key in a dictionary
@@ -147,7 +147,7 @@ int dictionary_set(dictionary *vd, char *key, char *val);
  * This function deletes a key in a dictionary. Nothing is done if the
  * key cannot be found.
  */
-void dictionary_unset(dictionary *d, char *key);
+void dictionary_unset(dictionary *d, const char *key);
 
 /**
  * @brief Dump a dictionary to an opened file pointer.
index 6cfb7244f981472994c813eb8d91fb72df99fd75..c6bd37e8f55c76cd72a2720669e8083d4d4585fe 100644 (file)
@@ -12,12 +12,12 @@ static void change_bit(unsigned char *arr, size_t index)
        arr[index / CHAR_BIT] ^= (1 << (index % CHAR_BIT));
 }
 
-static int count_trailing_zeroes(shachain_index_t index)
+static unsigned int count_trailing_zeroes(shachain_index_t index)
 {
 #if HAVE_BUILTIN_CTZLL
-       return index ? __builtin_ctzll(index) : INDEX_BITS;
+       return index ? (unsigned int)__builtin_ctzll(index) : INDEX_BITS;
 #else
-       int i;
+       unsigned int i;
 
        for (i = 0; i < INDEX_BITS; i++) {
                if (index & (1ULL << i))
@@ -77,7 +77,7 @@ void shachain_init(struct shachain *chain)
 bool shachain_add_hash(struct shachain *chain,
                       shachain_index_t index, const struct sha256 *hash)
 {
-       int i, pos;
+       unsigned int i, pos;
 
        /* You have to insert them in order! */
        assert(index == chain->min_index - 1 ||
@@ -107,7 +107,7 @@ bool shachain_add_hash(struct shachain *chain,
 bool shachain_get_hash(const struct shachain *chain,
                       shachain_index_t index, struct sha256 *hash)
 {
-       int i;
+       unsigned int i;
 
        for (i = 0; i < chain->num_valid; i++) {
                /* If we can get from key to index only by resetting bits,
index f7297cffcd34f11ad5d3cf652ad8b52b5e228abe..712180265a62e9ea5ec5492a974a4d187f3e006f 100644 (file)
@@ -16,8 +16,8 @@ int main(int argc, char *argv[])
        int val;
 #endif
 
-       generator_next_val(val, g);
-       printf("%d", val);
+       if (generator_next_val(val, g))
+               printf("%d", val);
 
        exit(0);
 }
index 7f4feb646508d8e0c43483a310141ac872679731..22ccdfc4a509ed911dc5c914ca8b0c2e7d490a53 100644 (file)
@@ -1,4 +1,5 @@
 #include <string.h>
+#include <stdio.h>
 #include "config.h"
 
 /**
diff --git a/ccan/strmap/LICENSE b/ccan/strmap/LICENSE
new file mode 120000 (symlink)
index 0000000..b7951da
--- /dev/null
@@ -0,0 +1 @@
+../../licenses/CC0
\ No newline at end of file
index 0cfea98446245ef3c0d9eb6882c4acf734e6cd83..f360a9611a8730838b6af1a9b23a2381b3bbc294 100644 (file)
@@ -256,7 +256,7 @@ const char *tal_name(const tal_t *ptr);
  * tal_count - get the count of objects in a tal_arr.
  * @ptr: The tal allocated object array.
  *
- * Returns 0 if @ptr has no length property, but we aware that that is
+ * Returns 0 if @ptr has no length property, but be aware that that is
  * also a valid size!
  */
 size_t tal_count(const tal_t *ptr);
index e6b16ef0ae2c97f4ac3a8289c05112f5d8ae900f..4c3394c977b5459eec1f7a3ec826cf8142f1728e 100644 (file)
@@ -22,8 +22,8 @@
  *     };
  *     struct parent {
  *             const char *name;
- *             struct tlist_children children;
  *             unsigned int num_children;
+ *             struct tlist_children children;
  *     };
  *
  *     struct child {
index 06732cc3c1e1b32dccc79677c4c42043c0a77e7d..d36cd8bcd41b456e0c399ce685dc67bdf099f7ff 100644 (file)
@@ -6,8 +6,8 @@ TLIST_TYPE(children, struct child);
 
 struct parent {
        const char *name;
-       struct tlist_children children;
        unsigned int num_children;
+       struct tlist_children children;
 };
 
 struct child {
index 28978514678d99a7df24ca66872465cf0cea3586..a99191a2e0ebd75e9b13145550ac90d0a859f72e 100644 (file)
  *
  * This declares a structure "struct tlist_@suffix" to use for
  * lists containing this type.  The actual list can be accessed using
- * ".raw" or tlist_raw().
+ * ".raw" or tlist_raw().  For maximum portability, place tlists
+ * embedded in structures as the last member.
  *
  * Example:
  *     // Defines struct tlist_children
  *     TLIST_TYPE(children, struct child);
  *     struct parent {
  *             const char *name;
- *             struct tlist_children children;
  *             unsigned int num_children;
+ *             struct tlist_children children;
  *     };
  *
  *     struct child {
index a487e09be712588122142c6d9274ff4b9397e4bd..f81a42b861fae905c4cbba2c1816b6cde4bb23ba 100644 (file)
@@ -46,8 +46,9 @@ int main(int argc, char *argv[])
        else
                deps = get_safe_ccan_deps(NULL, argv[1], style, recurse);
 
-       for (i = 0; deps[i]; i++)
-               if (strstarts(deps[i], "ccan/") == ccan)
-                       printf("%s\n", deps[i]);
+       if (deps)
+               for (i = 0; deps[i]; i++)
+                       if (strstarts(deps[i], "ccan/") == ccan)
+                               printf("%s\n", deps[i]);
        return 0;
 }
index 5d959cf33c6b04bdad29c8df6fb3d5f7e77874bc..67dadc61eb8a550cea7c3a86f491458a64647e81 100644 (file)
@@ -330,7 +330,7 @@ static struct test tests[] = {
          "     setcontext(&b);\n"
          "     x |= 4;\n"
          "}\n"
-         "int main(int argc, char *argv[]) {\n"
+         "int main(void) {\n"
          "     x |= 1;\n"
          "     getcontext(&a);\n"
          "     a.uc_stack.ss_sp = stack;\n"
@@ -354,7 +354,7 @@ static struct test tests[] = {
          "             worked = 1;\n"
          "     setcontext(&b);\n"
          "}\n"
-         "int main(int argc, char *argv[]) {\n"
+         "int main(void) {\n"
          "     void *ap = &worked;\n"
          "     void *aq = (void *)(~((ptrdiff_t)ap));\n"
          "     getcontext(&a);\n"
index d3245ca527fa946e98e4ae639b04331ee57d1b59..3494937a4009b1b7dad69eb9efe268e9e44fe1ad 100644 (file)
@@ -167,7 +167,7 @@ static void add_files(struct manifest *m, const char *base, const char *subdir)
                if (!m->info_file
                    && list_empty(&m->c_files)
                    && list_empty(&m->h_files))
-                       errx(1, "No _info, C or H files found here!");
+                       errx(1, "No _info, C or H files found in %s", thisdir);
 
                /* Don't enter subdirs with _info: they're separate modules. */
                for (i = 0; i < tal_count(subs); i++) {