[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r117804: * callproc.c (egetenv_internal): Add arg an
From: |
Dmitry Antipov |
Subject: |
[Emacs-diffs] trunk r117804: * callproc.c (egetenv_internal): Add arg and rename from egetenv ... |
Date: |
Tue, 02 Sep 2014 06:49:54 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 117804
revision-id: address@hidden
parent: address@hidden
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Tue 2014-09-02 10:49:40 +0400
message:
* callproc.c (egetenv_internal): Add arg and rename from egetenv ...
* lisp.h (egetenv): ... because of a new inline function used to
avoid calls to strlen for a compile-time constants.
modified:
src/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1438
src/callproc.c callproc.c-20091113204419-o5vbwnq5f7feedwu-248
src/lisp.h lisp.h-20091113204419-o5vbwnq5f7feedwu-253
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2014-09-02 05:44:38 +0000
+++ b/src/ChangeLog 2014-09-02 06:49:40 +0000
@@ -3,6 +3,9 @@
* fileio.c (CHECK_LENGTH): New macro.
(Fexpand_file_name): Use it and get rid of a few more calls
to strlen and strcat.
+ * callproc.c (egetenv_internal): Add arg and rename from egetenv ...
+ * lisp.h (egetenv): ... because of a new inline function used to
+ avoid calls to strlen for a compile-time constants.
2014-09-01 Dmitry Antipov <address@hidden>
=== modified file 'src/callproc.c'
--- a/src/callproc.c 2014-09-01 16:05:43 +0000
+++ b/src/callproc.c 2014-09-02 06:49:40 +0000
@@ -1488,14 +1488,14 @@
}
/* A version of getenv that consults the Lisp environment lists,
- easily callable from C. */
+ easily callable from C. This is usually called from egetenv. */
char *
-egetenv (const char *var)
+egetenv_internal (const char *var, ptrdiff_t len)
{
char *value;
ptrdiff_t valuelen;
- if (getenv_internal (var, strlen (var), &value, &valuelen, Qnil))
+ if (getenv_internal (var, len, &value, &valuelen, Qnil))
return value;
else
return 0;
=== modified file 'src/lisp.h'
--- a/src/lisp.h 2014-09-01 16:05:43 +0000
+++ b/src/lisp.h 2014-09-02 06:49:40 +0000
@@ -4442,7 +4442,16 @@
extern void dupstring (char **, char const *);
extern void xputenv (const char *);
-extern char *egetenv (const char *);
+extern char *egetenv_internal (const char *, ptrdiff_t);
+
+/* VAR is usually a compile-time constant, so the
+ call to strlen is likely to be optimized away. */
+
+INLINE char *
+egetenv(const char *var)
+{
+ return egetenv_internal (var, strlen (var));
+}
/* Copy Lisp string to temporary (allocated on stack) C string. */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r117804: * callproc.c (egetenv_internal): Add arg and rename from egetenv ...,
Dmitry Antipov <=