Trace lines are now shorter

This commit is contained in:
Luca Deri 2018-06-14 12:30:38 +02:00
parent 6c611ea306
commit 29de24c5d9
2 changed files with 235 additions and 238 deletions

4
n2n.c
View File

@ -117,7 +117,7 @@ void traceEvent(int eventTraceLevel, char* file, int line, char * format, ...) {
snprintf(out_buf, sizeof(out_buf), "%s%s", extra_msg, buf); snprintf(out_buf, sizeof(out_buf), "%s%s", extra_msg, buf);
syslog(LOG_INFO, "%s", out_buf); syslog(LOG_INFO, "%s", out_buf);
} else { } else {
snprintf(out_buf, sizeof(out_buf), "%s [%11s:%4d] %s%s", theDate, file, line, extra_msg, buf); snprintf(out_buf, sizeof(out_buf), "%s [%s:%d] %s%s", theDate, file, line, extra_msg, buf);
#ifdef __ANDROID_NDK__ #ifdef __ANDROID_NDK__
switch (eventTraceLevel) { switch (eventTraceLevel) {
case 0: // ERROR case 0: // ERROR
@ -148,7 +148,7 @@ void traceEvent(int eventTraceLevel, char* file, int line, char * format, ...) {
#else #else
/* this is the WIN32 code */ /* this is the WIN32 code */
for(i=strlen(file)-1; i>0; i--) if(file[i] == '\\') { i++; break; }; for(i=strlen(file)-1; i>0; i--) if(file[i] == '\\') { i++; break; };
snprintf(out_buf, sizeof(out_buf), "%s [%11s:%4d] %s%s", theDate, &file[i], line, extra_msg, buf); snprintf(out_buf, sizeof(out_buf), "%s [%s:%d] %s%s", theDate, &file[i], line, extra_msg, buf);
printf("%s\n", out_buf); printf("%s\n", out_buf);
fflush(stdout); fflush(stdout);
#endif #endif

View File

@ -469,8 +469,7 @@ int transop_twofish_init( n2n_trans_op_t * ttt )
priv = (transop_tf_t *) malloc( sizeof(transop_tf_t) ); priv = (transop_tf_t *) malloc( sizeof(transop_tf_t) );
if ( NULL != priv ) if ( NULL != priv ) {
{
size_t i; size_t i;
sa_twofish_t * sa=NULL; sa_twofish_t * sa=NULL;
@ -496,9 +495,7 @@ int transop_twofish_init( n2n_trans_op_t * ttt )
} }
retval = 0; retval = 0;
} } else {
else
{
memset( ttt, 0, sizeof(n2n_trans_op_t) ); memset( ttt, 0, sizeof(n2n_trans_op_t) );
traceEvent( TRACE_ERROR, "Failed to allocate priv for twofish" ); traceEvent( TRACE_ERROR, "Failed to allocate priv for twofish" );
} }