From aa04e465f30f7800ac975aab0f1f79806e606fb2 Mon Sep 17 00:00:00 2001 From: Kevin Easton Date: Sun, 30 Apr 2017 23:33:58 +1000 Subject: [PATCH] Document and simplify the ltoa() / my_ltoa() distinction The function provided (either by #define to the module table or directly in the case of scr-bx.c) is called my_ltoa(), and the #define in irc_std.h aliases this to ltoa(). --- include/irc_std.h | 2 ++ include/modval.h | 7 +------ source/scr-bx.c | 2 +- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/include/irc_std.h b/include/irc_std.h index cba32f5..c87bca0 100644 --- a/include/irc_std.h +++ b/include/irc_std.h @@ -238,6 +238,8 @@ int ioctl (int, int, ...); #define strncasecmp strnicmp #endif +/* We provide our own ltoa() rather than rely on the various non-standard ones + * that some platforms provide. */ #define ltoa(a) my_ltoa(a) /* diff --git a/include/modval.h b/include/modval.h index e9dc02a..f66af55 100644 --- a/include/modval.h +++ b/include/modval.h @@ -164,12 +164,7 @@ extern Function_ptr *global; #define plural (*(char * (*)(int))global[PLURAL]) #define my_ctime (*(char * (*)(time_t))global[MY_CTIME]) #define ccspan (*(size_t (*)(const char *, int))global[CCSPAN]) - -/* If we are in a module, undefine the previous define from ltoa to my_ltoa */ -#ifdef ltoa -#undef ltoa -#endif -#define ltoa (*(char *(*)(long ))global[LTOA]) +#define my_ltoa (*(char *(*)(long ))global[LTOA]) #define strformat (*(char *(*)(char *, const char *, int , char ))global[STRFORMAT]) #define MatchingBracket (*(char *(*)(char *, char , char ))global[MATCHINGBRACKET]) #define parse_number (*(int (*)(char **))global[PARSE_NUMBER]) diff --git a/source/scr-bx.c b/source/scr-bx.c index 7c16759..701c63d 100644 --- a/source/scr-bx.c +++ b/source/scr-bx.c @@ -97,7 +97,7 @@ int get_int_var(int var) return 1; } -char *ltoa (long foo) +char *my_ltoa(long foo) { static char buffer[BIG_BUFFER_SIZE/8+1]; char *pos = buffer + BIG_BUFFER_SIZE/8-1;