Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

chars default to NULL

  • Loading branch information...
commit 08be2e605d3989f47ed3d35d84b3dc3e7f6897c4 1 parent 313f8da
@toddtreece authored
Showing with 6 additions and 7 deletions.
  1. +2 −2 encodings.c
  2. +4 −5 io.c
View
4 encodings.c
@@ -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;
@@ -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;
View
9 io.c
@@ -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
@@ -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]);
@@ -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) {
@@ -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);
Please sign in to comment.
Something went wrong with that request. Please try again.