[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r31039 - gnunet/src/util
From: |
gnunet |
Subject: |
[GNUnet-SVN] r31039 - gnunet/src/util |
Date: |
Wed, 4 Dec 2013 13:48:32 +0100 |
Author: grothoff
Date: 2013-12-04 13:48:32 +0100 (Wed, 04 Dec 2013)
New Revision: 31039
Modified:
gnunet/src/util/os_installation.c
Log:
-reduce stat calls by caching result of GNUNET_OS_installation_get_path
Modified: gnunet/src/util/os_installation.c
===================================================================
--- gnunet/src/util/os_installation.c 2013-12-04 12:43:48 UTC (rev 31038)
+++ gnunet/src/util/os_installation.c 2013-12-04 12:48:32 UTC (rev 31039)
@@ -627,21 +627,24 @@
char *
GNUNET_OS_get_libexec_binary_path (const char *progname)
{
+ static char *cache;
char *libexecdir;
char *binary;
- if (DIR_SEPARATOR == progname[0])
+ if ( (DIR_SEPARATOR == progname[0]) ||
+ (GNUNET_YES == GNUNET_STRINGS_path_is_absolute (progname, GNUNET_NO,
NULL, NULL)) )
return GNUNET_strdup (progname);
- if (GNUNET_YES == GNUNET_STRINGS_path_is_absolute (progname, GNUNET_NO,
NULL, NULL))
- return GNUNET_strdup (progname);
- libexecdir = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_LIBEXECDIR);
+ if (NULL != cache)
+ libexecdir = cache;
+ else
+ libexecdir = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_LIBEXECDIR);
if (NULL == libexecdir)
return GNUNET_strdup (progname);
GNUNET_asprintf (&binary,
"%s%s",
libexecdir,
progname);
- GNUNET_free (libexecdir);
+ cache = libexecdir;
return binary;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r31039 - gnunet/src/util,
gnunet <=