From fbc1f5e4a9080c92d46c2776505b800e7cef602d Mon Sep 17 00:00:00 2001 From: vsc Date: Fri, 23 May 2008 13:16:13 +0000 Subject: [PATCH] fix sys.c for win32 git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@2245 b08c6af1-5177-4d33-ba66-4b1c6b8b522a --- library/system/sys.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/library/system/sys.c b/library/system/sys.c index 8ffe4d414..7f2f4db6d 100644 --- a/library/system/sys.c +++ b/library/system/sys.c @@ -8,8 +8,11 @@ * * ************************************************************************** * * -* $Id: sys.c,v 1.34 2008-05-22 23:25:21 vsc Exp $ * +* $Id: sys.c,v 1.35 2008-05-23 13:16:13 vsc Exp $ * * mods: $Log: not supported by cvs2svn $ +* mods: Revision 1.34 2008/05/22 23:25:21 vsc +* mods: add tmp_file/2 +* mods: * mods: Revision 1.33 2007/10/05 18:24:30 vsc * mods: fix garbage collector and fix LeaveGoal * mods: @@ -501,7 +504,6 @@ p_tmpnam(void) static int p_tmpdir(void) { - char *s; #if defined(__MINGW32__) || _MSC_VER char buf[512]; DWORD out = GetTempPath(512, buf); @@ -509,17 +511,18 @@ p_tmpdir(void) return(YAP_Unify(YAP_ARG2, WinError())); } if (out > 511) { - nbuf = malloc(out+1); + char *nbuf = malloc(out+1); if (!nbuf) return YAP_Unify(YAP_ARG2, YAP_MkAtomTerm(YAP_LookupAtom("no malloc memory"))); out = GetTempPath(512, nbuf); if (!out) { - return(YAP_Unify(YAP_ARG2, WinError())); + return YAP_Unify(YAP_ARG2, WinError()); } return YAP_Unify(YAP_ARG1,YAP_MkAtomTerm(YAP_LookupAtom(nbuf))); } return YAP_Unify(YAP_ARG1,YAP_MkAtomTerm(YAP_LookupAtom(buf))); #else + char *s; if ((s = getenv("TMPDIR"))) return YAP_Unify(YAP_ARG1,YAP_MkAtomTerm(YAP_LookupAtom(s))); #ifdef P_tmpdir