aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2017-12-11 09:22:49 +0100
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2017-12-11 09:31:46 +0100
commitcf2e07657e974d443283ce0a401210561ff9236c (patch)
tree05249317de6ecb9e5db1ec894ce1a20735b802bf
parentc31cd7737461cdab0dd9f78518147c826d53c606 (diff)
downloadnx-libs-cf2e07657e974d443283ce0a401210561ff9236c.tar.gz
nx-libs-cf2e07657e974d443283ce0a401210561ff9236c.tar.bz2
nx-libs-cf2e07657e974d443283ce0a401210561ff9236c.zip
Xserver/os/xprintf.c: Drop NoMachine's own implementation of Xvasprintf(). Use stock implementation instead.
* Reason from NoMachine's NX CHANGELOG for having its own implementation of Xvasprintf() (from around nxagent 3.3.0): - Fixed TR06G02225. The implementation of Xvprintf() has been reviewed to work on more platforms. Previous implementation caused a failure in the build of keyboard map on some platform like Solaris 8 and 9. - Fixed TR03G02198. Reimplemented Xvprintf() in Xserver/os to handle the case in which vsnprintf returned -1. * Reason for removing it again: - Fixes segfaults in SetDefaultFontPath when launching nxagent. - All locations in Xserver/** using the code check for return value of -1. - Solaris 8 and 9 are beyond of our support scope. - Keep more in sync with X.org. - Good moment to drop more GPL-2 code from Xserver's code base.
-rw-r--r--nx-X11/programs/Xserver/os/xprintf.c51
1 files changed, 1 insertions, 50 deletions
diff --git a/nx-X11/programs/Xserver/os/xprintf.c b/nx-X11/programs/Xserver/os/xprintf.c
index 2b10e6eba..1aeacad6d 100644
--- a/nx-X11/programs/Xserver/os/xprintf.c
+++ b/nx-X11/programs/Xserver/os/xprintf.c
@@ -89,54 +89,7 @@
#undef TEST
#undef DEBUG
-#define START_SIZE 256
-#define END_SIZE 2048
-
-int
-Xvasprintf(char **ret, const char *_X_RESTRICT_KYWD format, va_list va)
-{
- char *newret;
- int size;
- int r;
-
- size = 0;
-
- for (;;)
- {
- if (size == 0)
- {
- *ret = (char *)malloc(START_SIZE);
- if (*ret == NULL)
- return -1;
- size = START_SIZE;
- }
- else if (size < END_SIZE &&
- (newret = (char *) realloc(*ret, 2 * size)) != NULL)
- {
- *ret = newret;
- size = 2 * size;
- }
- else
- {
- free(*ret);
- return -1;
- }
-
- r = vsnprintf(*ret, size, format, va);
-
- if (r == -1 || r == size || r > size || r == size - 1)
- {
- continue;
- }
- else
- {
- (*ret)[r] = 0;
- return r;
- }
- }
-}
-
-#else
+#endif
/**
* Varargs sprintf that allocates a string buffer the right size for
@@ -171,8 +124,6 @@ Xvasprintf(char **ret, const char *_X_RESTRICT_KYWD format, va_list va)
#endif
}
-#endif
-
#ifndef HAVE_VASPRINTF
#define vasprintf Xvasprintf
#endif