Browse Source

Remove trailing whitespace

tags/json-c-0.13-20171207
Michael Vetter 11 years ago
parent
commit
fcf5ad1bd6
10 changed files with 37 additions and 37 deletions
  1. +1
    -1
      debug.c
  2. +5
    -5
      json_object.h
  3. +1
    -1
      json_tokener.c
  4. +4
    -4
      json_tokener.h
  5. +1
    -1
      libjson.c
  6. +11
    -11
      linkhash.c
  7. +2
    -2
      linkhash.h
  8. +8
    -8
      random_seed.c
  9. +3
    -3
      tests/test1.c
  10. +1
    -1
      tests/test_charcase.c

+ 1
- 1
debug.c View File

@@ -76,7 +76,7 @@ void mc_info(const char *msg, ...)
#if HAVE_VSYSLOG
if(_syslog) {
vsyslog(LOG_INFO, msg, ap);
} else
} else
#endif
vfprintf(stderr, msg, ap);
va_end(ap);


+ 5
- 5
json_object.h View File

@@ -111,7 +111,7 @@ typedef enum json_type {
/* reference counting functions */

/**
* Increment the reference count of json_object, thereby grabbing shared
* Increment the reference count of json_object, thereby grabbing shared
* ownership of obj.
*
* @param obj the json_object instance
@@ -178,7 +178,7 @@ flags);
* Set a custom serialization function to be used when this particular object
* is converted to a string by json_object_to_json_string.
*
* If a custom serializer is already set on this object, any existing
* If a custom serializer is already set on this object, any existing
* user_delete function is called before the new one is set.
*
* If to_string_func is NULL, the other parameters are ignored
@@ -290,9 +290,9 @@ extern void json_object_object_add(struct json_object* obj, const char *key,
THIS_FUNCTION_IS_DEPRECATED(extern struct json_object* json_object_object_get(struct json_object* obj,
const char *key));

/** Get the json_object associated with a given object field.
/** Get the json_object associated with a given object field.
*
* This returns true if the key is found, false in all other cases (including
* This returns true if the key is found, false in all other cases (including
* if obj isn't a json_type_object).
*
* *No* reference counts will be changed. There is no need to manually adjust
@@ -302,7 +302,7 @@ THIS_FUNCTION_IS_DEPRECATED(extern struct json_object* json_object_object_get(st
*
* @param obj the json_object instance
* @param key the object field name
* @param value a pointer where to store a reference to the json_object
* @param value a pointer where to store a reference to the json_object
* associated with the given field name.
*
* It is safe to pass a NULL value.


+ 1
- 1
json_tokener.c View File

@@ -371,7 +371,7 @@ struct json_object* json_tokener_parse_ex(struct json_tokener *tok,
{
if (tok->st_pos == json_inf_str_len)
{
current = json_object_new_double(is_negative ? -INFINITY : INFINITY);
current = json_object_new_double(is_negative ? -INFINITY : INFINITY);
saved_state = json_tokener_state_finish;
state = json_tokener_state_eatws;
goto redo_char;


+ 4
- 4
json_tokener.h View File

@@ -130,16 +130,16 @@ extern struct json_object* json_tokener_parse_verbose(const char *str, enum json
*/
extern void json_tokener_set_flags(struct json_tokener *tok, int flags);

/**
/**
* Parse a string and return a non-NULL json_object if a valid JSON value
* is found. The string does not need to be a JSON object or array;
* it can also be a string, number or boolean value.
*
* A partial JSON string can be parsed. If the parsing is incomplete,
* NULL will be returned and json_tokener_get_error() will be return
* NULL will be returned and json_tokener_get_error() will be return
* json_tokener_continue.
* json_tokener_parse_ex() can then be called with additional bytes in str
* to continue the parsing.
* to continue the parsing.
*
* If json_tokener_parse_ex() returns NULL and the error anything other than
* json_tokener_continue, a fatal error has occurred and parsing must be
@@ -152,7 +152,7 @@ extern void json_tokener_set_flags(struct json_tokener *tok, int flags);
* json_object_get_type() before using the object.
*
* @b XXX this shouldn't use internal fields:
* Trailing characters after the parsed value do not automatically cause an
* Trailing characters after the parsed value do not automatically cause an
* error. It is up to the caller to decide whether to treat this as an
* error or to handle the additional characters, perhaps by parsing another
* json value starting from that point.


+ 1
- 1
libjson.c View File

@@ -16,7 +16,7 @@
#define __warn_references(sym,msg) /* nothing */
#endif

#endif
#endif

#include "json_object.h"



+ 11
- 11
linkhash.c View File

@@ -44,7 +44,7 @@ int lh_ptr_equal(const void *k1, const void *k2)
return (k1 == k2);
}

/*
/*
* hashlittle from lookup3.c, by Bob Jenkins, May 2006, Public Domain.
* http://burtleburtle.net/bob/c/lookup3.c
* minor modifications to make functions static so no symbols are exported
@@ -56,8 +56,8 @@ int lh_ptr_equal(const void *k1, const void *k2)
lookup3.c, by Bob Jenkins, May 2006, Public Domain.

These are functions for producing 32-bit hashes for hash table lookup.
hashword(), hashlittle(), hashlittle2(), hashbig(), mix(), and final()
are externally useful functions. Routines to test the hash are included
hashword(), hashlittle(), hashlittle2(), hashbig(), mix(), and final()
are externally useful functions. Routines to test the hash are included
if SELF_TEST is defined. You can use this free for any purpose. It's in
the public domain. It has no warranty.

@@ -65,7 +65,7 @@ You probably want to use hashlittle(). hashlittle() and hashbig()
hash byte arrays. hashlittle() is is faster than hashbig() on
little-endian machines. Intel and AMD are little-endian machines.
On second thought, you probably want hashlittle2(), which is identical to
hashlittle() except it returns two 32-bit hashes for the price of one.
hashlittle() except it returns two 32-bit hashes for the price of one.
You could implement hashbig2() if you wanted but I haven't bothered here.

If you want to find a hash of, say, exactly 7 integers, do
@@ -78,9 +78,9 @@ If you want to find a hash of, say, exactly 7 integers, do
then use c as the hash value. If you have a variable length array of
4-byte integers to hash, use hashword(). If you have a byte array (like
a character string), use hashlittle(). If you have several byte arrays, or
a mix of things, see the comments above hashlittle().
a mix of things, see the comments above hashlittle().

Why is this so big? I read 12 bytes at a time into 3 4-byte integers,
Why is this so big? I read 12 bytes at a time into 3 4-byte integers,
then mix those integers. This is fast (you can do a lot more thorough
mixing with 12*3 instructions on 3 integers than you can with 3 instructions
on 1 byte), but shoehorning those bytes into integers efficiently is messy.
@@ -129,7 +129,7 @@ This was tested for:
the output delta to a Gray code (a^(a>>1)) so a string of 1's (as
is commonly produced by subtraction) look like a single 1-bit
difference.
* the base values were pseudorandom, all zero but one bit set, or
* the base values were pseudorandom, all zero but one bit set, or
all zero plus a counter that starts at zero.

Some k values for my "a-=c; a^=rot(c,k); c+=b;" arrangement that
@@ -139,7 +139,7 @@ satisfy this are
14 9 3 7 17 3
Well, "9 15 3 18 27 15" didn't quite get 32 bits diffing
for "differ" defined as + with a one-bit base and a two-bit delta. I
used http://burtleburtle.net/bob/hash/avalanche.html to choose
used http://burtleburtle.net/bob/hash/avalanche.html to choose
the operations, constants, and arrangements of the variables.

This does not achieve avalanche. There are input bits of (a,b,c)
@@ -178,7 +178,7 @@ produce values of c that look totally different. This was tested for
the output delta to a Gray code (a^(a>>1)) so a string of 1's (as
is commonly produced by subtraction) look like a single 1-bit
difference.
* the base values were pseudorandom, all zero but one bit set, or
* the base values were pseudorandom, all zero but one bit set, or
all zero plus a counter that starts at zero.

These constants passed:
@@ -253,7 +253,7 @@ static uint32_t hashlittle( const void *key, size_t length, uint32_t initval)
}

/*----------------------------- handle the last (probably partial) block */
/*
/*
* "k[2]&0xffffff" actually reads beyond the end of the string, but
* then masks off the part it's not allowed to read. Because the
* string is aligned, the masked-off tail is in the same word as the
@@ -415,7 +415,7 @@ unsigned long lh_char_hash(const void *k)
#endif
}

return hashlittle((const char*)k, strlen((const char*)k), random_seed);
return hashlittle((const char*)k, strlen((const char*)k), random_seed);
}

int lh_char_equal(const void *k1, const void *k2)


+ 2
- 2
linkhash.h View File

@@ -9,7 +9,7 @@
* it under the terms of the MIT license. See COPYING for details.
*
*/
#ifndef _linkhash_h_
#define _linkhash_h_

@@ -26,7 +26,7 @@ extern "C" {

/**
* The fraction of filled hash buckets until an insert will cause the table
* to be resized.
* to be resized.
* This can range from just above 0 up to 1.0.
*/
#define LH_LOAD_FACTOR 0.66


+ 8
- 8
random_seed.c View File

@@ -150,13 +150,13 @@ static int has_dev_urandom()
static int get_dev_random_seed()
{
DEBUG_SEED("get_dev_random_seed");
int fd = open(dev_random_file, O_RDONLY);
if (fd < 0) {
fprintf(stderr, "error opening %s: %s", dev_random_file, strerror(errno));
exit(1);
}
int r;
ssize_t nread = read(fd, &r, sizeof(r));
if (nread != sizeof(r)) {
@@ -186,22 +186,22 @@ static int get_dev_random_seed()
static int get_cryptgenrandom_seed()
{
DEBUG_SEED("get_cryptgenrandom_seed");
HCRYPTPROV hProvider = 0;
int r;
if (!CryptAcquireContextW(&hProvider, 0, 0, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) {
fprintf(stderr, "error CryptAcquireContextW");
exit(1);
}
if (!CryptGenRandom(hProvider, sizeof(r), (BYTE*)&r)) {
fprintf(stderr, "error CryptGenRandom");
exit(1);
}
CryptReleaseContext(hProvider, 0);
return r;
}

@@ -215,7 +215,7 @@ static int get_cryptgenrandom_seed()
static int get_time_seed()
{
DEBUG_SEED("get_time_seed");
return (int)time(NULL) * 433494437;
}



+ 3
- 3
tests/test1.c View File

@@ -76,7 +76,7 @@ int main(int argc, char **argv)
json_object *obj = json_object_array_get_idx(my_array, i);
printf("\t[%d]=%s\n", i, json_object_to_json_string(obj));
}
printf("my_array.to_string()=%s\n", json_object_to_json_string(my_array));
printf("my_array.to_string()=%s\n", json_object_to_json_string(my_array));

json_object_put(my_array);

@@ -91,7 +91,7 @@ int main(int argc, char **argv)
json_object *obj = json_object_array_get_idx(my_array, i);
printf("\t[%d]=%s\n", i, json_object_to_json_string(obj));
}
printf("my_array.to_string()=%s\n", json_object_to_json_string(my_array));
printf("my_array.to_string()=%s\n", json_object_to_json_string(my_array));
json_object_array_sort(my_array, sort_fn);
printf("my_array=\n");
for(i=0; i < json_object_array_length(my_array); i++)
@@ -99,7 +99,7 @@ int main(int argc, char **argv)
json_object *obj = json_object_array_get_idx(my_array, i);
printf("\t[%d]=%s\n", i, json_object_to_json_string(obj));
}
printf("my_array.to_string()=%s\n", json_object_to_json_string(my_array));
printf("my_array.to_string()=%s\n", json_object_to_json_string(my_array));

my_object = json_object_new_object();
json_object_object_add(my_object, "abc", json_object_new_int(12));


+ 1
- 1
tests/test_charcase.c View File

@@ -35,6 +35,6 @@ static void test_case_parse()
assert (new_obj == NULL);

printf("OK\n");
json_tokener_free(tok);
}

Loading…
Cancel
Save