Permalink
Browse files

Merge pull request #54 from fotonauts/static_functions_pull_request

functions should have a declaration or should be static
CDRIVER-179 Some functions should be static
  • Loading branch information...
2 parents 8a60b9b + f0e5bc9 commit fe6642df480fa1747599902b8b3c0979013a9445 @gjmurakami-10gen gjmurakami-10gen committed Nov 14, 2012
Showing with 13 additions and 13 deletions.
  1. +5 −5 src/bson.c
  2. +1 −1 src/env_posix.c
  3. +7 −7 src/mongo.c
View
@@ -598,22 +598,22 @@ void bson_init_size( bson *b, int size ) {
_bson_init_size( b, size );
}
-void bson_append_byte( bson *b, char c ) {
+static void bson_append_byte( bson *b, char c ) {
b->cur[0] = c;
b->cur++;
}
-void bson_append( bson *b, const void *data, int len ) {
+static void bson_append( bson *b, const void *data, int len ) {
memcpy( b->cur , data , len );
b->cur += len;
}
-void bson_append32( bson *b, const void *data ) {
+static void bson_append32( bson *b, const void *data ) {
bson_little_endian32( b->cur, data );
b->cur += 4;
}
-void bson_append64( bson *b, const void *data ) {
+static void bson_append64( bson *b, const void *data ) {
bson_little_endian64( b->cur, data );
b->cur += 8;
}
@@ -740,7 +740,7 @@ MONGO_EXPORT int bson_append_undefined( bson *b, const char *name ) {
return BSON_OK;
}
-int bson_append_string_base( bson *b, const char *name,
+static int bson_append_string_base( bson *b, const char *name,
const char *value, int len, bson_type type ) {
int sl = len + 1;
View
@@ -100,7 +100,7 @@ int mongo_env_set_socket_op_timeout( mongo *conn, int millis ) {
return MONGO_OK;
}
-int mongo_env_unix_socket_connect( mongo *conn, const char *sock_path ) {
+static int mongo_env_unix_socket_connect( mongo *conn, const char *sock_path ) {
struct sockaddr_un addr;
int status, len;
View
@@ -48,7 +48,7 @@ MONGO_EXPORT int mongo_get_op_timeout(mongo* conn) {
}
-const char* _get_host_port(mongo_host_port* hp) {
+static const char* _get_host_port(mongo_host_port* hp) {
static char _hp[sizeof(hp->host)+12];
bson_sprintf(_hp, "%s:%d", hp->host, hp->port);
return _hp;
@@ -268,7 +268,7 @@ static void mongo_set_last_error( mongo *conn, bson_iterator *it, bson *obj ) {
static const int ZERO = 0;
static const int ONE = 1;
-mongo_message *mongo_message_create( int len , int id , int responseTo , int op ) {
+static mongo_message *mongo_message_create( int len , int id , int responseTo , int op ) {
mongo_message *mm = ( mongo_message * )bson_malloc( len );
if ( !id )
@@ -284,7 +284,7 @@ mongo_message *mongo_message_create( int len , int id , int responseTo , int op
}
/* Always calls bson_free(mm) */
-int mongo_message_send( mongo *conn, mongo_message *mm ) {
+static int mongo_message_send( mongo *conn, mongo_message *mm ) {
mongo_header head; /* little endian */
int res;
bson_little_endian32( &head.len, &mm->head.len );
@@ -308,7 +308,7 @@ int mongo_message_send( mongo *conn, mongo_message *mm ) {
return MONGO_OK;
}
-int mongo_read_response( mongo *conn, mongo_reply **reply ) {
+static int mongo_read_response( mongo *conn, mongo_reply **reply ) {
mongo_header head; /* header from network */
mongo_reply_fields fields; /* header from network */
mongo_reply *out; /* native endian */
@@ -347,17 +347,17 @@ int mongo_read_response( mongo *conn, mongo_reply **reply ) {
}
-char *mongo_data_append( char *start , const void *data , int len ) {
+static char *mongo_data_append( char *start , const void *data , int len ) {
memcpy( start , data , len );
return start + len;
}
-char *mongo_data_append32( char *start , const void *data ) {
+static char *mongo_data_append32( char *start , const void *data ) {
bson_little_endian32( start , data );
return start + 4;
}
-char *mongo_data_append64( char *start , const void *data ) {
+static char *mongo_data_append64( char *start , const void *data ) {
bson_little_endian64( start , data );
return start + 8;
}

0 comments on commit fe6642d

Please sign in to comment.