summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/comp.el
diff options
context:
space:
mode:
authorAndrea Corallo <akrl@sdf.org>2020-07-02 21:32:09 +0200
committerAndrea Corallo <akrl@sdf.org>2020-07-02 22:39:39 +0200
commit8f81859497b7dd0c537d24a27985a26ffc778a3a (patch)
treeee1fa1e36b46f5df7840bec74ddaced503e7517f /lisp/emacs-lisp/comp.el
parentb67e156041fb4bb3bc4a2cc60bca4408d092b59b (diff)
downloademacs-8f81859497b7dd0c537d24a27985a26ffc778a3a.tar.gz
emacs-8f81859497b7dd0c537d24a27985a26ffc778a3a.tar.bz2
emacs-8f81859497b7dd0c537d24a27985a26ffc778a3a.zip
Rework `comp-c-func-name' arguments
* lisp/emacs-lisp/comp.el (comp-c-func-name): Add FIRST argument to ignore the compiler context and return the first name. * lisp/emacs-lisp/disass.el (disassemble-internal): Update the `comp-c-func-name' call.
Diffstat (limited to 'lisp/emacs-lisp/comp.el')
-rw-r--r--lisp/emacs-lisp/comp.el8
1 files changed, 5 insertions, 3 deletions
diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
index 205966f57c6..a16cf1dcc88 100644
--- a/lisp/emacs-lisp/comp.el
+++ b/lisp/emacs-lisp/comp.el
@@ -566,9 +566,11 @@ instruction."
(or (comp-spill-decl-spec function-name 'speed)
comp-speed))
-(defun comp-c-func-name (name prefix)
+(defun comp-c-func-name (name prefix &optional first)
"Given NAME return a name suitable for the native code.
-Put PREFIX in front of it."
+Add PREFIX in front of it. If FIRST is not nil pick the first
+available name ignoring compilation context and potential name
+clashes."
;; Unfortunatelly not all symbol names are valid as C function names...
;; Nassi's algorithm here:
(let* ((orig-name (if (symbolp name) (symbol-name name) name))
@@ -583,7 +585,7 @@ Put PREFIX in front of it."
"-" "_" orig-name))
(human-readable (replace-regexp-in-string
(rx (not (any "0-9a-z_"))) "" human-readable)))
- (if comp-ctxt
+ (if (null first)
;; Prevent C namespace conflicts.
(cl-loop
with h = (comp-ctxt-funcs-h comp-ctxt)