*/
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];
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;
* 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
/* The remaining exposed functions are documented in dictionary.h */
-unsigned dictionary_hash(char *key)
+unsigned dictionary_hash(const char *key)
{
int len;
unsigned hash;
return;
}
-char *dictionary_get(dictionary *d, char *key, char *def)
+char *dictionary_get(dictionary *d, const char *key, char *def)
{
unsigned hash;
int i;
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;
return 0;
}
-void dictionary_unset(dictionary *d, char *key)
+void dictionary_unset(dictionary *d, const char *key)
{
unsigned hash;
int i;
* 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.
* 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.
*
* 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
* 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.
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))
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 ||
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,
int val;
#endif
- generator_next_val(val, g);
- printf("%d", val);
+ if (generator_next_val(val, g))
+ printf("%d", val);
exit(0);
}
#include <string.h>
+#include <stdio.h>
#include "config.h"
/**
--- /dev/null
+../../licenses/CC0
\ No newline at end of file
* 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);
* };
* struct parent {
* const char *name;
- * struct tlist_children children;
* unsigned int num_children;
+ * struct tlist_children children;
* };
*
* struct child {
struct parent {
const char *name;
- struct tlist_children children;
unsigned int num_children;
+ struct tlist_children children;
};
struct child {
*
* 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 {
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;
}
" 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"
" 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"
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++) {