-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change internal funcs _foo_bar() to foo__bar().
- Loading branch information
Showing
47 changed files
with
1,770 additions
and
1,770 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
Copyright (c) 2009-2014 Roger Light <[email protected]> | ||
Copyright (c) 2009-2015 Roger Light <[email protected]> | ||
All rights reserved. This program and the accompanying materials | ||
are made available under the terms of the Eclipse Public License v1.0 | ||
|
@@ -22,7 +22,7 @@ and the Eclipse Distribution License is available at | |
#include <mosquitto.h> | ||
#include <memory_mosq.h> | ||
|
||
int _mosquitto_log_printf(struct mosquitto *mosq, int priority, const char *fmt, ...) | ||
int mosquitto__log_printf(struct mosquitto *mosq, int priority, const char *fmt, ...) | ||
{ | ||
va_list va; | ||
char *s; | ||
|
@@ -34,7 +34,7 @@ int _mosquitto_log_printf(struct mosquitto *mosq, int priority, const char *fmt, | |
pthread_mutex_lock(&mosq->log_callback_mutex); | ||
if(mosq->on_log){ | ||
len = strlen(fmt) + 500; | ||
s = _mosquitto_malloc(len*sizeof(char)); | ||
s = mosquitto__malloc(len*sizeof(char)); | ||
if(!s){ | ||
pthread_mutex_unlock(&mosq->log_callback_mutex); | ||
return MOSQ_ERR_NOMEM; | ||
|
@@ -47,7 +47,7 @@ int _mosquitto_log_printf(struct mosquitto *mosq, int priority, const char *fmt, | |
|
||
mosq->on_log(mosq, mosq->userdata, priority, s); | ||
|
||
_mosquitto_free(s); | ||
mosquitto__free(s); | ||
} | ||
pthread_mutex_unlock(&mosq->log_callback_mutex); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
Copyright (c) 2009-2014 Roger Light <[email protected]> | ||
Copyright (c) 2009-2015 Roger Light <[email protected]> | ||
All rights reserved. This program and the accompanying materials | ||
are made available under the terms of the Eclipse Public License v1.0 | ||
|
@@ -18,6 +18,6 @@ and the Eclipse Distribution License is available at | |
|
||
#include <mosquitto.h> | ||
|
||
int _mosquitto_log_printf(struct mosquitto *mosq, int priority, const char *fmt, ...); | ||
int mosquitto__log_printf(struct mosquitto *mosq, int priority, const char *fmt, ...); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
Copyright (c) 2009-2014 Roger Light <[email protected]> | ||
Copyright (c) 2009-2015 Roger Light <[email protected]> | ||
All rights reserved. This program and the accompanying materials | ||
are made available under the terms of the Eclipse Public License v1.0 | ||
|
@@ -37,7 +37,7 @@ static unsigned long memcount = 0; | |
static unsigned long max_memcount = 0; | ||
#endif | ||
|
||
void *_mosquitto_calloc(size_t nmemb, size_t size) | ||
void *mosquitto__calloc(size_t nmemb, size_t size) | ||
{ | ||
void *mem = calloc(nmemb, size); | ||
|
||
|
@@ -51,15 +51,15 @@ void *_mosquitto_calloc(size_t nmemb, size_t size) | |
return mem; | ||
} | ||
|
||
void _mosquitto_free(void *mem) | ||
void mosquitto__free(void *mem) | ||
{ | ||
#ifdef REAL_WITH_MEMORY_TRACKING | ||
memcount -= malloc_usable_size(mem); | ||
#endif | ||
free(mem); | ||
} | ||
|
||
void *_mosquitto_malloc(size_t size) | ||
void *mosquitto__malloc(size_t size) | ||
{ | ||
void *mem = malloc(size); | ||
|
||
|
@@ -74,18 +74,18 @@ void *_mosquitto_malloc(size_t size) | |
} | ||
|
||
#ifdef REAL_WITH_MEMORY_TRACKING | ||
unsigned long _mosquitto_memory_used(void) | ||
unsigned long mosquitto__memory_used(void) | ||
{ | ||
return memcount; | ||
} | ||
|
||
unsigned long _mosquitto_max_memory_used(void) | ||
unsigned long mosquitto__max_memory_used(void) | ||
{ | ||
return max_memcount; | ||
} | ||
#endif | ||
|
||
void *_mosquitto_realloc(void *ptr, size_t size) | ||
void *mosquitto__realloc(void *ptr, size_t size) | ||
{ | ||
void *mem; | ||
#ifdef REAL_WITH_MEMORY_TRACKING | ||
|
@@ -105,7 +105,7 @@ void *_mosquitto_realloc(void *ptr, size_t size) | |
return mem; | ||
} | ||
|
||
char *_mosquitto_strdup(const char *s) | ||
char *mosquitto__strdup(const char *s) | ||
{ | ||
char *str = strdup(s); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
Copyright (c) 2010-2014 Roger Light <[email protected]> | ||
Copyright (c) 2010-2015 Roger Light <[email protected]> | ||
All rights reserved. This program and the accompanying materials | ||
are made available under the terms of the Eclipse Public License v1.0 | ||
|
@@ -24,14 +24,14 @@ and the Eclipse Distribution License is available at | |
#define REAL_WITH_MEMORY_TRACKING | ||
#endif | ||
|
||
void *_mosquitto_calloc(size_t nmemb, size_t size); | ||
void _mosquitto_free(void *mem); | ||
void *_mosquitto_malloc(size_t size); | ||
void *mosquitto__calloc(size_t nmemb, size_t size); | ||
void mosquitto__free(void *mem); | ||
void *mosquitto__malloc(size_t size); | ||
#ifdef REAL_WITH_MEMORY_TRACKING | ||
unsigned long _mosquitto_memory_used(void); | ||
unsigned long _mosquitto_max_memory_used(void); | ||
unsigned long mosquitto__memory_used(void); | ||
unsigned long mosquitto__max_memory_used(void); | ||
#endif | ||
void *_mosquitto_realloc(void *ptr, size_t size); | ||
char *_mosquitto_strdup(const char *s); | ||
void *mosquitto__realloc(void *ptr, size_t size); | ||
char *mosquitto__strdup(const char *s); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
Copyright (c) 2010-2014 Roger Light <[email protected]> | ||
Copyright (c) 2010-2015 Roger Light <[email protected]> | ||
All rights reserved. This program and the accompanying materials | ||
are made available under the terms of the Eclipse Public License v1.0 | ||
|
@@ -25,33 +25,33 @@ and the Eclipse Distribution License is available at | |
#include <send_mosq.h> | ||
#include <time_mosq.h> | ||
|
||
void _mosquitto_message_cleanup(struct mosquitto_message_all **message) | ||
void mosquitto__message_cleanup(struct mosquitto_message_all **message) | ||
{ | ||
struct mosquitto_message_all *msg; | ||
|
||
if(!message || !*message) return; | ||
|
||
msg = *message; | ||
|
||
if(msg->msg.topic) _mosquitto_free(msg->msg.topic); | ||
if(msg->msg.payload) _mosquitto_free(msg->msg.payload); | ||
_mosquitto_free(msg); | ||
if(msg->msg.topic) mosquitto__free(msg->msg.topic); | ||
if(msg->msg.payload) mosquitto__free(msg->msg.payload); | ||
mosquitto__free(msg); | ||
} | ||
|
||
void _mosquitto_message_cleanup_all(struct mosquitto *mosq) | ||
void mosquitto__message_cleanup_all(struct mosquitto *mosq) | ||
{ | ||
struct mosquitto_message_all *tmp; | ||
|
||
assert(mosq); | ||
|
||
while(mosq->in_messages){ | ||
tmp = mosq->in_messages->next; | ||
_mosquitto_message_cleanup(&mosq->in_messages); | ||
mosquitto__message_cleanup(&mosq->in_messages); | ||
mosq->in_messages = tmp; | ||
} | ||
while(mosq->out_messages){ | ||
tmp = mosq->out_messages->next; | ||
_mosquitto_message_cleanup(&mosq->out_messages); | ||
mosquitto__message_cleanup(&mosq->out_messages); | ||
mosq->out_messages = tmp; | ||
} | ||
} | ||
|
@@ -61,14 +61,14 @@ int mosquitto_message_copy(struct mosquitto_message *dst, const struct mosquitto | |
if(!dst || !src) return MOSQ_ERR_INVAL; | ||
|
||
dst->mid = src->mid; | ||
dst->topic = _mosquitto_strdup(src->topic); | ||
dst->topic = mosquitto__strdup(src->topic); | ||
if(!dst->topic) return MOSQ_ERR_NOMEM; | ||
dst->qos = src->qos; | ||
dst->retain = src->retain; | ||
if(src->payloadlen){ | ||
dst->payload = _mosquitto_malloc(src->payloadlen); | ||
dst->payload = mosquitto__malloc(src->payloadlen); | ||
if(!dst->payload){ | ||
_mosquitto_free(dst->topic); | ||
mosquitto__free(dst->topic); | ||
return MOSQ_ERR_NOMEM; | ||
} | ||
memcpy(dst->payload, src->payload, src->payloadlen); | ||
|
@@ -80,15 +80,15 @@ int mosquitto_message_copy(struct mosquitto_message *dst, const struct mosquitto | |
return MOSQ_ERR_SUCCESS; | ||
} | ||
|
||
int _mosquitto_message_delete(struct mosquitto *mosq, uint16_t mid, enum mosquitto_msg_direction dir) | ||
int mosquitto__message_delete(struct mosquitto *mosq, uint16_t mid, enum mosquitto_msg_direction dir) | ||
{ | ||
struct mosquitto_message_all *message; | ||
int rc; | ||
assert(mosq); | ||
|
||
rc = _mosquitto_message_remove(mosq, mid, dir, &message); | ||
rc = mosquitto__message_remove(mosq, mid, dir, &message); | ||
if(rc == MOSQ_ERR_SUCCESS){ | ||
_mosquitto_message_cleanup(&message); | ||
mosquitto__message_cleanup(&message); | ||
} | ||
return rc; | ||
} | ||
|
@@ -101,12 +101,12 @@ void mosquitto_message_free(struct mosquitto_message **message) | |
|
||
msg = *message; | ||
|
||
if(msg->topic) _mosquitto_free(msg->topic); | ||
if(msg->payload) _mosquitto_free(msg->payload); | ||
_mosquitto_free(msg); | ||
if(msg->topic) mosquitto__free(msg->topic); | ||
if(msg->payload) mosquitto__free(msg->payload); | ||
mosquitto__free(msg); | ||
} | ||
|
||
void _mosquitto_message_queue(struct mosquitto *mosq, struct mosquitto_message_all *message, enum mosquitto_msg_direction dir) | ||
void mosquitto__message_queue(struct mosquitto *mosq, struct mosquitto_message_all *message, enum mosquitto_msg_direction dir) | ||
{ | ||
/* mosq->*_message_mutex should be locked before entering this function */ | ||
assert(mosq); | ||
|
@@ -136,7 +136,7 @@ void _mosquitto_message_queue(struct mosquitto *mosq, struct mosquitto_message_a | |
} | ||
} | ||
|
||
void _mosquitto_messages_reconnect_reset(struct mosquitto *mosq) | ||
void mosquitto__messages_reconnect_reset(struct mosquitto *mosq) | ||
{ | ||
struct mosquitto_message_all *message; | ||
struct mosquitto_message_all *prev = NULL; | ||
|
@@ -151,11 +151,11 @@ void _mosquitto_messages_reconnect_reset(struct mosquitto *mosq) | |
if(message->msg.qos != 2){ | ||
if(prev){ | ||
prev->next = message->next; | ||
_mosquitto_message_cleanup(&message); | ||
mosquitto__message_cleanup(&message); | ||
message = prev; | ||
}else{ | ||
mosq->in_messages = message->next; | ||
_mosquitto_message_cleanup(&message); | ||
mosquitto__message_cleanup(&message); | ||
message = mosq->in_messages; | ||
} | ||
}else{ | ||
|
@@ -196,7 +196,7 @@ void _mosquitto_messages_reconnect_reset(struct mosquitto *mosq) | |
pthread_mutex_unlock(&mosq->out_message_mutex); | ||
} | ||
|
||
int _mosquitto_message_remove(struct mosquitto *mosq, uint16_t mid, enum mosquitto_msg_direction dir, struct mosquitto_message_all **message) | ||
int mosquitto__message_remove(struct mosquitto *mosq, uint16_t mid, enum mosquitto_msg_direction dir, struct mosquitto_message_all **message) | ||
{ | ||
struct mosquitto_message_all *cur, *prev = NULL; | ||
bool found = false; | ||
|
@@ -242,7 +242,7 @@ int _mosquitto_message_remove(struct mosquitto *mosq, uint16_t mid, enum mosquit | |
}else if(cur->msg.qos == 2){ | ||
cur->state = mosq_ms_wait_for_pubrec; | ||
} | ||
rc = _mosquitto_send_publish(mosq, cur->msg.mid, cur->msg.topic, cur->msg.payloadlen, cur->msg.payload, cur->msg.qos, cur->msg.retain, cur->dup); | ||
rc = mosquitto__send_publish(mosq, cur->msg.mid, cur->msg.topic, cur->msg.payloadlen, cur->msg.payload, cur->msg.qos, cur->msg.retain, cur->dup); | ||
if(rc){ | ||
pthread_mutex_unlock(&mosq->out_message_mutex); | ||
return rc; | ||
|
@@ -294,9 +294,9 @@ int _mosquitto_message_remove(struct mosquitto *mosq, uint16_t mid, enum mosquit | |
} | ||
|
||
#ifdef WITH_THREADING | ||
void _mosquitto_message_retry_check_actual(struct mosquitto *mosq, struct mosquitto_message_all *messages, pthread_mutex_t *mutex) | ||
void mosquitto__message_retry_check_actual(struct mosquitto *mosq, struct mosquitto_message_all *messages, pthread_mutex_t *mutex) | ||
#else | ||
void _mosquitto_message_retry_check_actual(struct mosquitto *mosq, struct mosquitto_message_all *messages) | ||
void mosquitto__message_retry_check_actual(struct mosquitto *mosq, struct mosquitto_message_all *messages) | ||
#endif | ||
{ | ||
time_t now = mosquitto_time(); | ||
|
@@ -313,17 +313,17 @@ void _mosquitto_message_retry_check_actual(struct mosquitto *mosq, struct mosqui | |
case mosq_ms_wait_for_pubrec: | ||
messages->timestamp = now; | ||
messages->dup = true; | ||
_mosquitto_send_publish(mosq, messages->msg.mid, messages->msg.topic, messages->msg.payloadlen, messages->msg.payload, messages->msg.qos, messages->msg.retain, messages->dup); | ||
mosquitto__send_publish(mosq, messages->msg.mid, messages->msg.topic, messages->msg.payloadlen, messages->msg.payload, messages->msg.qos, messages->msg.retain, messages->dup); | ||
break; | ||
case mosq_ms_wait_for_pubrel: | ||
messages->timestamp = now; | ||
messages->dup = true; | ||
_mosquitto_send_pubrec(mosq, messages->msg.mid); | ||
mosquitto__send_pubrec(mosq, messages->msg.mid); | ||
break; | ||
case mosq_ms_wait_for_pubcomp: | ||
messages->timestamp = now; | ||
messages->dup = true; | ||
_mosquitto_send_pubrel(mosq, messages->msg.mid); | ||
mosquitto__send_pubrel(mosq, messages->msg.mid); | ||
break; | ||
default: | ||
break; | ||
|
@@ -336,14 +336,14 @@ void _mosquitto_message_retry_check_actual(struct mosquitto *mosq, struct mosqui | |
#endif | ||
} | ||
|
||
void _mosquitto_message_retry_check(struct mosquitto *mosq) | ||
void mosquitto__message_retry_check(struct mosquitto *mosq) | ||
{ | ||
#ifdef WITH_THREADING | ||
_mosquitto_message_retry_check_actual(mosq, mosq->out_messages, &mosq->out_message_mutex); | ||
_mosquitto_message_retry_check_actual(mosq, mosq->in_messages, &mosq->in_message_mutex); | ||
mosquitto__message_retry_check_actual(mosq, mosq->out_messages, &mosq->out_message_mutex); | ||
mosquitto__message_retry_check_actual(mosq, mosq->in_messages, &mosq->in_message_mutex); | ||
#else | ||
_mosquitto_message_retry_check_actual(mosq, mosq->out_messages); | ||
_mosquitto_message_retry_check_actual(mosq, mosq->in_messages); | ||
mosquitto__message_retry_check_actual(mosq, mosq->out_messages); | ||
mosquitto__message_retry_check_actual(mosq, mosq->in_messages); | ||
#endif | ||
} | ||
|
||
|
@@ -353,7 +353,7 @@ void mosquitto_message_retry_set(struct mosquitto *mosq, unsigned int message_re | |
if(mosq) mosq->message_retry = message_retry; | ||
} | ||
|
||
int _mosquitto_message_out_update(struct mosquitto *mosq, uint16_t mid, enum mosquitto_msg_state state) | ||
int mosquitto__message_out_update(struct mosquitto *mosq, uint16_t mid, enum mosquitto_msg_state state) | ||
{ | ||
struct mosquitto_message_all *message; | ||
assert(mosq); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
Copyright (c) 2010-2014 Roger Light <[email protected]> | ||
Copyright (c) 2010-2015 Roger Light <[email protected]> | ||
All rights reserved. This program and the accompanying materials | ||
are made available under the terms of the Eclipse Public License v1.0 | ||
|
@@ -19,13 +19,13 @@ and the Eclipse Distribution License is available at | |
#include <mosquitto_internal.h> | ||
#include <mosquitto.h> | ||
|
||
void _mosquitto_message_cleanup_all(struct mosquitto *mosq); | ||
void _mosquitto_message_cleanup(struct mosquitto_message_all **message); | ||
int _mosquitto_message_delete(struct mosquitto *mosq, uint16_t mid, enum mosquitto_msg_direction dir); | ||
void _mosquitto_message_queue(struct mosquitto *mosq, struct mosquitto_message_all *message, enum mosquitto_msg_direction dir); | ||
void _mosquitto_messages_reconnect_reset(struct mosquitto *mosq); | ||
int _mosquitto_message_remove(struct mosquitto *mosq, uint16_t mid, enum mosquitto_msg_direction dir, struct mosquitto_message_all **message); | ||
void _mosquitto_message_retry_check(struct mosquitto *mosq); | ||
int _mosquitto_message_out_update(struct mosquitto *mosq, uint16_t mid, enum mosquitto_msg_state state); | ||
void mosquitto__message_cleanup_all(struct mosquitto *mosq); | ||
void mosquitto__message_cleanup(struct mosquitto_message_all **message); | ||
int mosquitto__message_delete(struct mosquitto *mosq, uint16_t mid, enum mosquitto_msg_direction dir); | ||
void mosquitto__message_queue(struct mosquitto *mosq, struct mosquitto_message_all *message, enum mosquitto_msg_direction dir); | ||
void mosquitto__messages_reconnect_reset(struct mosquitto *mosq); | ||
int mosquitto__message_remove(struct mosquitto *mosq, uint16_t mid, enum mosquitto_msg_direction dir, struct mosquitto_message_all **message); | ||
void mosquitto__message_retry_check(struct mosquitto *mosq); | ||
int mosquitto__message_out_update(struct mosquitto *mosq, uint16_t mid, enum mosquitto_msg_state state); | ||
|
||
#endif |
Oops, something went wrong.