From 7f77dbe3b0f46f9c769b5d7a226849ee3db05b38 Mon Sep 17 00:00:00 2001 From: Gerd Moellmann Date: Sat, 5 Aug 2000 19:26:46 +0000 Subject: [PATCH] (opendir, GetTempDirName, run_mac_command): Use xmalloc instead of malloc. (run_mac_command, closedir): Use `xfree' instead of `free'. --- src/sysdep.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/sysdep.c b/src/sysdep.c index 39973d6cbd7..c4f9991af45 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -3525,7 +3525,7 @@ opendir (filename) BLOCK_INPUT; if (fstat (fd, &sbuf) < 0 || (sbuf.st_mode & S_IFMT) != S_IFDIR - || (dirp = (DIR *) malloc (sizeof (DIR))) == 0) + || (dirp = (DIR *) xmalloc (sizeof (DIR))) == 0) { emacs_close (fd); UNBLOCK_INPUT; @@ -6354,7 +6354,7 @@ GetTempDirName () else if (mkdir (unixDirName, 0700) != 0) /* create it if not */ return NULL; - TempDirName = (char *) malloc (strlen (unixDirName) + 1); + TempDirName = (char *) xmalloc (strlen (unixDirName) + 1); strcpy (TempDirName, unixDirName); } @@ -6594,7 +6594,7 @@ run_mac_command (argv, workdir, infn, outfn, errfn) /* After expanding all the arguments, we now know the length of the parameter block to be sent to the subprocess as a message attached to the HLE. */ - param = (char *) malloc (paramlen + 1); + param = (char *) xmalloc (paramlen + 1); if (!param) return -1; @@ -6623,7 +6623,7 @@ run_mac_command (argv, workdir, infn, outfn, errfn) iErr = FSMakeFSSpec (0, 0, macappname, &spec); if (iErr != noErr) { - free (param); + xfree (param); return -1; } @@ -6634,10 +6634,11 @@ run_mac_command (argv, workdir, infn, outfn, errfn) lpbr.launchAppParameters = NULL; iErr = LaunchApplication (&lpbr); /* call the subprocess */ - if (iErr != noErr) { - free (param); - return -1; - } + if (iErr != noErr) + { + xfree (param); + return -1; + } sendEvent.what = kHighLevelEvent; sendEvent.message = kEmacsSubprocessSend; /* Event ID stored in "where" unused */ @@ -6649,7 +6650,7 @@ run_mac_command (argv, workdir, infn, outfn, errfn) while (iErr == sessClosedErr && retries-- > 0); if (iErr != noErr) { - free (param); + xfree (param); return -1; } @@ -6664,12 +6665,12 @@ run_mac_command (argv, workdir, infn, outfn, errfn) iErr = AcceptHighLevelEvent (&targ, &refCon, NULL, &len); if (iErr != noErr) { DisposeHandle ((Handle) cursorRegionHdl); - free (param); + xfree (param); return -1; } DisposeHandle ((Handle) cursorRegionHdl); - free (param); + xfree (param); return refCon; } @@ -6682,7 +6683,7 @@ opendir (const char *dirname) CInfoPBRec cipb; int len; - dirp = (DIR *) malloc (sizeof (DIR)); + dirp = (DIR *) xmalloc (sizeof (DIR)); if (!dirp) return 0; -- 2.39.2