From 3bb54f97e7e470a7ea99ff0880b36f14952c2d7a Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Fri, 25 Feb 2022 00:14:47 +0100 Subject: [PATCH] Fix typos in code comments and ChangeLog --- ChangeLog | 8 ++++---- json_object.h | 6 +++--- json_tokener.c | 2 +- linkhash.c | 6 +++--- linkhash.h | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1c562b7d..88776316 100644 --- a/ChangeLog +++ b/ChangeLog @@ -73,7 +73,7 @@ Other changes * #589 - Detect broken RDRAND during initialization; also, fix segfault in the CPUID check. * #592 - Fix integer overflows to prevert out of bounds write on large input. -* Protect against division by zero in linkhash, when creaed with zero size. +* Protect against division by zero in linkhash, when created with zero size. * #602 - Fix json_parse_uint64() internal error checking, leaving the retval untouched in more failure cases. * #614 - Prevent truncation when custom double formatters insert extra \0's @@ -199,7 +199,7 @@ Behavior changes: * Use size_t for array length and size. Platforms where sizeof(size_t) != sizeof(int) may not be backwards compatible See commits 45c56b, 92e9a5 and others. -* Check for failue when allocating memory, returning NULL and errno=ENOMEM. +* Check for failure when allocating memory, returning NULL and errno=ENOMEM. See commit 2149a04. * Change json_object_object_add() return type from void to int, and will return -1 on failures, instead of exiting. (Note: this is not an ABI change) @@ -390,7 +390,7 @@ List of new functions added: * Add an alternative iterator implementation, see json_object_iterator.h * Make json_object_iter public to enable external use of the json_object_object_foreachC macro. - * Add a printbuf_memset() function to provide an effecient way to set and + * Add a printbuf_memset() function to provide an efficient way to set and append things like whitespace indentation. * Adjust json_object_is_type and json_object_get_type so they return json_type_null for NULL objects and handle NULL passed to @@ -476,7 +476,7 @@ List of new functions added: 0.7 === * Add escaping of backslash to json output - * Add escaping of foward slash on tokenizing and output + * Add escaping of forward slash on tokenizing and output * Changes to internal tokenizer from using recursion to using a depth state structure to allow incremental parsing diff --git a/json_object.h b/json_object.h index 0f779a52..5203a67e 100644 --- a/json_object.h +++ b/json_object.h @@ -139,7 +139,7 @@ extern "C" { * beyond the lifetime of the parent object. * - Detaching an object field or array index from its parent object * (using `json_object_object_del()` or `json_object_array_del_idx()`) - * - Sharing a json_object with multiple (not necesarily parallel) threads + * - Sharing a json_object with multiple (not necessarily parallel) threads * of execution that all expect to free it (with `json_object_put()`) when * they're done. * @@ -747,7 +747,7 @@ JSON_EXPORT int json_object_set_int(struct json_object *obj, int new_value); * * @param obj the json_object instance * @param val the value to add - * @returns 1 if the increment succeded, 0 otherwise + * @returns 1 if the increment succeeded, 0 otherwise */ JSON_EXPORT int json_object_int_inc(struct json_object *obj, int64_t val); @@ -1064,7 +1064,7 @@ JSON_EXPORT json_c_shallow_copy_fn json_c_shallow_copy_default; * when custom serializers are in use. See also * json_object set_serializer. * - * @returns 0 if the copy went well, -1 if an error occured during copy + * @returns 0 if the copy went well, -1 if an error occurred during copy * or if the destination pointer is non-NULL */ diff --git a/json_tokener.c b/json_tokener.c index 4a25645d..160cde49 100644 --- a/json_tokener.c +++ b/json_tokener.c @@ -746,7 +746,7 @@ struct json_object *json_tokener_parse_ex(struct json_tokener *tok, const char * * we can't simply peek ahead here, because the * characters we need might not be passed to us * until a subsequent call to json_tokener_parse. - * Instead, transition throug a couple of states. + * Instead, transition through a couple of states. * (now): * _escape_unicode => _unicode_need_escape * (see a '\\' char): diff --git a/linkhash.c b/linkhash.c index d2f2b1bc..6105160c 100644 --- a/linkhash.c +++ b/linkhash.c @@ -285,7 +285,7 @@ static uint32_t hashlittle(const void *key, size_t length, uint32_t initval) * rest of the string. Every machine with memory protection I've seen * does it on word boundaries, so is OK with this. But VALGRIND will * still catch it and complain. The masking trick does make the hash - * noticably faster for short strings (like English words). + * noticeably faster for short strings (like English words). * AddressSanitizer is similarly picky about overrunning * the buffer. (http://clang.llvm.org/docs/AddressSanitizer.html */ @@ -439,7 +439,7 @@ static uint32_t hashlittle(const void *key, size_t length, uint32_t initval) } /* clang-format on */ -/* a simple hash function similiar to what perl does for strings. +/* a simple hash function similar to what perl does for strings. * for good results, the string should not be excessivly large. */ static unsigned long lh_perllike_str_hash(const void *k) @@ -465,7 +465,7 @@ static unsigned long lh_char_hash(const void *k) if (random_seed == -1) { RANDOM_SEED_TYPE seed; - /* we can't use -1 as it is the unitialized sentinel */ + /* we can't use -1 as it is the uninitialized sentinel */ while ((seed = json_c_get_random_seed()) == -1) {} #if SIZEOF_INT == 8 && defined __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 #define USE_SYNC_COMPARE_AND_SWAP 1 diff --git a/linkhash.h b/linkhash.h index cb6e3b42..5e5e2408 100644 --- a/linkhash.h +++ b/linkhash.h @@ -353,7 +353,7 @@ static _LH_INLINE struct lh_entry *lh_table_head(const lh_table *t) /** * Calculate the hash of a key for a given table. * - * This is an exension to support functions that need to calculate + * This is an extension to support functions that need to calculate * the hash several times and allows them to do it just once and then pass * in the hash to all utility functions. Depending on use case, this can be a * considerable performance improvement. -- 2.39.5