emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

feature/tree-sitter d452539966 3/4: Avoid usage of intern_c_string in tr


From: Po Lu
Subject: feature/tree-sitter d452539966 3/4: Avoid usage of intern_c_string in treesit.c
Date: Mon, 21 Nov 2022 01:10:37 -0500 (EST)

branch: feature/tree-sitter
commit d45253996670509e668d266d577f48deb9c7018f
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Avoid usage of intern_c_string in treesit.c
    
    * src/treesit.c (Ftreesit_pattern_expand): Use DEFSYM'd symbols
    when the naming makes sense.
    (syms_of_treesit): Add new defsyms QCanchor, QCequal, QCmatch.
---
 src/treesit.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/treesit.c b/src/treesit.c
index a2f528860f..291698e4e4 100644
--- a/src/treesit.c
+++ b/src/treesit.c
@@ -2042,7 +2042,7 @@ PATTERN can be
 See Info node `(elisp)Pattern Matching' for detailed explanation.  */)
   (Lisp_Object pattern)
 {
-  if (EQ (pattern, intern_c_string (":anchor")))
+  if (EQ (pattern, QCanchor))
     return build_pure_c_string (".");
   if (EQ (pattern, intern_c_string (":?")))
     return build_pure_c_string ("?");
@@ -2050,9 +2050,9 @@ See Info node `(elisp)Pattern Matching' for detailed 
explanation.  */)
     return build_pure_c_string ("*");
   if (EQ (pattern, intern_c_string (":+")))
     return build_pure_c_string ("+");
-  if (EQ (pattern, intern_c_string (":equal")))
+  if (EQ (pattern, QCequal))
     return build_pure_c_string ("#equal");
-  if (EQ (pattern, intern_c_string (":match")))
+  if (EQ (pattern, QCmatch))
     return build_pure_c_string ("#match");
   Lisp_Object opening_delimeter
     = build_pure_c_string (VECTORP (pattern) ? "[" : "(");
@@ -2060,7 +2060,7 @@ See Info node `(elisp)Pattern Matching' for detailed 
explanation.  */)
     = build_pure_c_string (VECTORP (pattern) ? "]" : ")");
   if (VECTORP (pattern) || CONSP (pattern))
     return concat3 (opening_delimeter,
-                   Fmapconcat (intern_c_string ("treesit-pattern-expand"),
+                   Fmapconcat (Qtreesit_pattern_expand,
                                pattern,
                                build_pure_c_string (" ")),
                    closing_delimiter);
@@ -2938,6 +2938,10 @@ syms_of_treesit (void)
   DEFSYM (Qoutdated, "outdated");
   DEFSYM (Qhas_error, "has-error");
 
+  DEFSYM (QCanchor, ":anchor");
+  DEFSYM (QCequal, ":equal");
+  DEFSYM (QCmatch, ":match");
+
   DEFSYM (Qnot_found, "not-found");
   DEFSYM (Qsymbol_error, "symbol-error");
   DEFSYM (Qversion_mismatch, "version-mismatch");



reply via email to

[Prev in Thread] Current Thread [Next in Thread]