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().
This commit is contained in:
Kevin Easton
2017-04-30 23:33:58 +10:00
parent 7ee8799b8e
commit aa04e465f3
3 changed files with 4 additions and 7 deletions

View File

@@ -238,6 +238,8 @@ int ioctl (int, int, ...);
#define strncasecmp strnicmp #define strncasecmp strnicmp
#endif #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) #define ltoa(a) my_ltoa(a)
/* /*

View File

@@ -164,12 +164,7 @@ extern Function_ptr *global;
#define plural (*(char * (*)(int))global[PLURAL]) #define plural (*(char * (*)(int))global[PLURAL])
#define my_ctime (*(char * (*)(time_t))global[MY_CTIME]) #define my_ctime (*(char * (*)(time_t))global[MY_CTIME])
#define ccspan (*(size_t (*)(const char *, int))global[CCSPAN]) #define ccspan (*(size_t (*)(const char *, int))global[CCSPAN])
#define my_ltoa (*(char *(*)(long ))global[LTOA])
/* 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 strformat (*(char *(*)(char *, const char *, int , char ))global[STRFORMAT]) #define strformat (*(char *(*)(char *, const char *, int , char ))global[STRFORMAT])
#define MatchingBracket (*(char *(*)(char *, char , char ))global[MATCHINGBRACKET]) #define MatchingBracket (*(char *(*)(char *, char , char ))global[MATCHINGBRACKET])
#define parse_number (*(int (*)(char **))global[PARSE_NUMBER]) #define parse_number (*(int (*)(char **))global[PARSE_NUMBER])

View File

@@ -97,7 +97,7 @@ int get_int_var(int var)
return 1; return 1;
} }
char *ltoa (long foo) char *my_ltoa(long foo)
{ {
static char buffer[BIG_BUFFER_SIZE/8+1]; static char buffer[BIG_BUFFER_SIZE/8+1];
char *pos = buffer + BIG_BUFFER_SIZE/8-1; char *pos = buffer + BIG_BUFFER_SIZE/8-1;