X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=lib%2Futils.c;h=b00a73bc7c5e7adc2d3f4305f77f1bb654844cb5;hb=f02d3ed3e135b5326003e7f69f8331ff6a3cc219;hp=2e40ef5889f8c6890ed3eaed5b45483ebc8c4ba3;hpb=013a2e159e42c46808ea8d0b6abd57525db30a50;p=tinc diff --git a/lib/utils.c b/lib/utils.c index 2e40ef58..b00a73bc 100644 --- a/lib/utils.c +++ b/lib/utils.c @@ -1,7 +1,7 @@ /* utils.c -- gathering of some stupid small functions - Copyright (C) 1999-2003 Ivo Timmermans - 2000-2003 Guus Sliepen + Copyright (C) 1999-2005 Ivo Timmermans + 2000-2006 Guus Sliepen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -31,8 +31,7 @@ volatile int cp_index = 0; char *hexadecimals = "0123456789ABCDEF"; -int charhex2bin(char c) -{ +int charhex2bin(char c) { if(isdigit(c)) return c - '0'; else @@ -40,15 +39,13 @@ int charhex2bin(char c) } -void hex2bin(char *src, char *dst, int length) -{ +void hex2bin(char *src, char *dst, int length) { int i; for(i = 0; i < length; i++) dst[i] = charhex2bin(src[i * 2]) * 16 + charhex2bin(src[i * 2 + 1]); } -void bin2hex(char *src, char *dst, int length) -{ +void bin2hex(char *src, char *dst, int length) { int i; for(i = length - 1; i >= 0; i--) { dst[i * 2 + 1] = hexadecimals[(unsigned char) src[i] & 15]; @@ -57,8 +54,7 @@ void bin2hex(char *src, char *dst, int length) } #ifdef ENABLE_TRACING -void cp_trace() -{ +void cp_trace() { logger(LOG_DEBUG, "Checkpoint trace: %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d...", cp_file[(cp_index + 15) % 16], cp_line[(cp_index + 15) % 16], cp_file[(cp_index + 14) % 16], cp_line[(cp_index + 14) % 16],