]> git.eshelyaron.com Git - emacs.git/commitdiff
Rework `comp-c-func-name' arguments
authorAndrea Corallo <akrl@sdf.org>
Thu, 2 Jul 2020 19:32:09 +0000 (21:32 +0200)
committerAndrea Corallo <akrl@sdf.org>
Thu, 2 Jul 2020 20:39:39 +0000 (22:39 +0200)
* 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.

lisp/emacs-lisp/comp.el
lisp/emacs-lisp/disass.el

index 205966f57c68bc87d8ed053af331de05b7b03222..a16cf1dcc88f3c851b87744038766c668c2da2b5 100644 (file)
@@ -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)
index 82c8de6e133fdd482432604c0abc3870ae0cfb0c..aa8b248f39ef44b2cf4b55a51b9a0b366bdfb34d 100644 (file)
@@ -96,7 +96,7 @@ redefine OBJECT if it is a symbol."
                                          (regexp-quote
                                           (concat "<"
                                                   (comp-c-func-name
-                                                   (subr-name obj) "F")
+                                                   (subr-name obj) "F" t)
                                                   ">:"))))
               (beginning-of-line)
               (delete-region (point-min) (point))