Skip to content

Commit

Permalink
chars default to NULL
Browse files Browse the repository at this point in the history
  • Loading branch information
toddtreece committed Jan 19, 2012
1 parent 313f8da commit 08be2e6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions encodings.c
Expand Up @@ -103,7 +103,7 @@ static char* convert(const char* src, int src_len, int *new_len, const char* fro
/* returns a new string that must be freed */
char* utf8_encode(const char *str) {

char *out;
char *out = NULL;

if(strlen(str)) {
int alen, len;
Expand All @@ -118,7 +118,7 @@ char* utf8_encode(const char *str) {
/* returns a new string, possibly decoded */
char* utf8_decode(const char *str) {

char *out;
char *out = NULL;

if (strlen(str)) {
int alen, len;
Expand Down
9 changes: 4 additions & 5 deletions io.c
Expand Up @@ -37,8 +37,7 @@ long long mongodb_save(UDF_INIT *initid, UDF_ARGS *args, char *result, unsigned
}

pthread_mutex_unlock(&mongodb_mutex);



bson b[1];

// the first argument is reserved
Expand Down Expand Up @@ -68,7 +67,7 @@ long long mongodb_save(UDF_INIT *initid, UDF_ARGS *args, char *result, unsigned

} else {

char *item;
char *item = NULL;

item = utf8_encode(args->args[i]);

Expand Down Expand Up @@ -111,7 +110,7 @@ long long mongodb_save(UDF_INIT *initid, UDF_ARGS *args, char *result, unsigned

bson_finish(b);

pthread_mutex_lock(&mongodb_mutex);
pthread_mutex_lock(&mongodb_mutex);

if(mongo_insert(mongodb_connection, args->args[0], b) == MONGO_ERROR && mongodb_connection->err == MONGO_IO_ERROR) {

Expand All @@ -121,7 +120,7 @@ long long mongodb_save(UDF_INIT *initid, UDF_ARGS *args, char *result, unsigned

}

pthread_mutex_unlock(&mongodb_mutex);
pthread_mutex_unlock(&mongodb_mutex);

bson_destroy(b);

Expand Down

0 comments on commit 08be2e6

Please sign in to comment.