Re: non-official updated version of glpk (4.62 pre-release)
Chris Matrakidis <[email protected]>
| Newsgroups | gmane.comp.gnu.glpk |
|---|---|
| Message-ID | <CAEaJ3S58d9bRMrBbYnA2pQMC0HTjNvSG6Q3XFH+40QKyE=1Npw@mail.gmail.com> |
Hi Andrew, The attached patch adds the _s variants for windows. I have only tested it using mingw64, so some some additional testing would be appropriate. Best Regards, Chris Matrakidis On 30 January 2017 at 13:07, Andrew Makhorin <[email protected]> wrote: > Please see an updated version of glpk here: > http://sourceforge.net/projects/noumenon/files/tmp/ > (Note that this is *not* an official release.) > > The following main changes were made: > > 1. glp_config was added to the export section (for MS Windows). > > 2. Calls to non-thread-safe functions gmtime, strerror, and strtok were > replaced by calls to corresponding thread-safe equivalents (gmtime_r, > strerror_r, and strtok_r for GNU/Linux). > > If the application calls glpk routines from multiple threads, the > following should be taken into account: > > 1) a thread should not access glpk program objects (e.g. glp_proc) > created by other threads; > > 2) to prevent memory leaks each thread before termination should call > the glpk api routine glp_free_env. > > > Andrew Makhorin > > > _______________________________________________ > Help-glpk mailing list > [email protected] > https://lists.gnu.org/mailman/listinfo/help-glpk _______________________________________________ Help-glpk mailing list [email protected] https://lists.gnu.org/mailman/listinfo/help-glpk
stdc.patch
(application/octet-stream, 820 B)
diff --git a/src/env/stdc.c b/src/env/stdc.c
index f229dd3..faffa59 100644
--- a/src/env/stdc.c
+++ b/src/env/stdc.c
@@ -32,22 +32,23 @@ char *xstrtok(char *s1, const char *s2)
#elif defined(__WOE__)
-#define ENABLE_NON_SAFE
#include "stdc.h"
struct tm *xgmtime(const time_t *timer)
-{ return
- gmtime(timer);
+{ static TLS struct tm result;
+ gmtime_s(&result, timer);
+ return &result;
}
char *xstrerr(int errnum)
-{ return
- strerror(errnum);
+{ static TLS char s[255+1];
+ strerror_s(s, sizeof(s), errnum);
+ return s;
}
char *xstrtok(char *s1, const char *s2)
-{ return
- strtok(s1, s2);
+{ static TLS char *ptr;
+ return strtok_s(s1, s2, &ptr);
}
/* GNU/Linux version **************************************************/