|
From: <sv...@va...> - 2014-09-27 13:14:48
|
Author: florian
Date: Sat Sep 27 14:14:40 2014
New Revision: 14574
Log:
Followup to r14203.
Fix indentation (sigh) and tell emacs how to do it next time.
Use VG_(realloc) instead of VG_(arena_realloc).
Use 500 as an initial buffer size which is already quite generous.
PATH_MAX which is 4096 on linux is clearly overkill.
Modified:
branches/BUF_REMOVAL/coregrind/m_libcfile.c
Modified: branches/BUF_REMOVAL/coregrind/m_libcfile.c
==============================================================================
--- branches/BUF_REMOVAL/coregrind/m_libcfile.c (original)
+++ branches/BUF_REMOVAL/coregrind/m_libcfile.c Sat Sep 27 14:14:40 2014
@@ -1,3 +1,4 @@
+/* -*- mode: C; c-basic-offset: 3; -*- */
/*--------------------------------------------------------------------*/
/*--- File- and socket-related libc stuff. m_libcfile.c ---*/
@@ -38,7 +39,7 @@
#include "pub_core_libcprint.h" // VG_(sprintf)
#include "pub_core_libcproc.h" // VG_(getpid), VG_(getppid)
#include "pub_core_clientstate.h" // VG_(fd_hard_limit)
-#include "pub_core_mallocfree.h" // VG_(arena_realloc)
+#include "pub_core_mallocfree.h" // VG_(realloc)
#include "pub_core_syscall.h"
/* IMPORTANT: on Darwin it is essential to use the _nocancel versions
@@ -1242,8 +1243,8 @@
SizeT need = end-p+1 + 1;
if (need > buf_len) {
- buf_len = (buf_len == 0) ? VKI_PATH_MAX : need;
- buf = VG_(arena_realloc)(VG_AR_CORE, "basename", buf, buf_len);
+ buf_len = (buf_len == 0) ? 500 : need;
+ buf = VG_(arena_realloc)(VG_AR_CORE, "basename", buf, buf_len);
}
VG_(strncpy)(buf, p, end-p+1);
buf[end-p+1] = '\0';
@@ -1289,8 +1290,8 @@
SizeT need = p-path+1 + 1;
if (need > buf_len) {
- buf_len = (buf_len == 0) ? VKI_PATH_MAX : need;
- buf = VG_(arena_realloc)(VG_AR_CORE, "dirname", buf, buf_len);
+ buf_len = (buf_len == 0) ? 500 : need;
+ buf = VG_(realloc)("dirname", buf, buf_len);
}
VG_(strncpy)(buf, path, p-path+1);
buf[p-path+1] = '\0';
|