Mercurial > dwindows
diff dwcompat.c @ 1991:d83a86f5fe7f
OS/2: Move internal snprintf() into dw.h and dwcompat.h so it can be used
anywhere that includes dw.h or dwcompat.h allowing continued use of VAC.
Fix an issue where PIPENAME was erroneously defined in the Windows section,
breaking any non-windows systems using domain sockets, like OS/2 with VAC.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Mon, 16 Sep 2019 19:12:39 +0000 |
parents | 433b7c772ff0 |
children | 05dd5189099f |
line wrap: on
line diff
--- a/dwcompat.c Mon Sep 16 17:48:21 2019 +0000 +++ b/dwcompat.c Mon Sep 16 19:12:39 2019 +0000 @@ -30,29 +30,6 @@ #include <time.h> #include <errno.h> -/* Mostly safe but slow snprintf() for compilers that don't have it... - * like VisualAge. So we can write safe code and still use VAC to test. - */ -#if defined(__IBMC__) && !defined(snprintf) -static int snprintf(char *str, size_t size, const char *format, ...) -{ - va_list args; - char *outbuf = calloc(1, size + strlen(format) + 1024); - int retval = -1; - - if(outbuf) - { - va_start(args, format); - vsprintf(outbuf, format, args); - va_end(args); - retval = strlen(outbuf); - strncpy(str, outbuf, size); - free(outbuf); - } - return retval; -} -#endif - #if defined(__UNIX__) || defined(__MAC__) void msleep(long period) {