mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-12-23 01:29:33 +00:00
added max printf2log message size
This commit is contained in:
parent
3739cd8eea
commit
4c131d6975
@ -26,28 +26,25 @@
|
|||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* This file is part of the Configurable Sensor Network Application
|
* $Id: printf2log.h,v 1.3 2008/01/11 15:37:38 fros4943 Exp $
|
||||||
* Architecture for sensor nodes running the Contiki operating system.
|
|
||||||
*
|
|
||||||
* $Id: printf2log.h,v 1.2 2007/11/25 22:48:35 fros4943 Exp $
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __PRINTF2LOG_H__
|
#ifndef __PRINTF2LOG_H__
|
||||||
#define __PRINTF2LOG_H__
|
#define __PRINTF2LOG_H__
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
#include "sys/log.h"
|
#include "sys/log.h"
|
||||||
|
|
||||||
void simlog(const char *message);
|
#define PRINTF2LOG_SIZE 128
|
||||||
|
|
||||||
#define MAX_SIZE 256
|
#define printf(...) \
|
||||||
|
do { \
|
||||||
#define printf(...) \
|
char printf2log_buf[PRINTF2LOG_SIZE]; \
|
||||||
{ \
|
snprintf(printf2log_buf, PRINTF2LOG_SIZE, __VA_ARGS__); \
|
||||||
char printf2log_buf[MAX_SIZE]; \
|
printf2log_buf[PRINTF2LOG_SIZE - 1] = 0; \
|
||||||
int c = sprintf(printf2log_buf, __VA_ARGS__); \
|
simlog(printf2log_buf); \
|
||||||
printf2log_buf[c] = 0; \
|
} while (0)
|
||||||
simlog(printf2log_buf); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* __PRINTF2LOG_H__ */
|
#endif /* __PRINTF2LOG_H__ */
|
||||||
|
Loading…
Reference in New Issue
Block a user