From 9ab00f542f5f0b6e8aecd3eb510c951a9b6129a4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Gerd=20M=C3=B6llmann?= Date: Thu, 20 Oct 2022 13:06:46 +0200 Subject: [PATCH] Introduce PACKAGE_NAMEX PACKAGE_NAME Is already taken :-(. --- src/lisp.h | 6 ++++++ src/pkg.c | 6 +++--- src/print.c | 7 +++---- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/lisp.h b/src/lisp.h index 6a48dc10d35..2042dbbd2f9 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -2262,6 +2262,12 @@ PACKAGE_SYMBOLS (Lisp_Object package) return XPACKAGE (package)->symbols; } +INLINE Lisp_Object +PACKAGE_NAMEX (Lisp_Object package) +{ + return XPACKAGE (package)->name; +} + extern void init_pkg_once (void); extern void init_pkg (void); extern void syms_of_pkg (void); diff --git a/src/pkg.c b/src/pkg.c index 26b69da683d..bf59b9e4fe3 100644 --- a/src/pkg.c +++ b/src/pkg.c @@ -611,13 +611,13 @@ pkg_qualified_symbol (Lisp_Object name, Lisp_Object package, bool external) if (EQ (found, Qunbound)) pkg_error ("Symbol '%s' is not accessible in package '%s'", - SDATA (name), SDATA (XPACKAGE (package)->name)); + SDATA (name), SDATA (PACKAGE_NAMEX (package))); /* Check if the symbol is accesible in the package as external symbol. PKG-FIXME: Check what to do for inherited symbols. */ if (external && EQ (status, QCinternal)) pkg_error ("Symbol '%s' is internal in package '%s'", - SDATA (name), SDATA (XPACKAGE (package)->name)); + SDATA (name), SDATA (PACKAGE_NAMEX (package))); return found; } @@ -736,7 +736,7 @@ DEFUN ("package-%name", Fpackage_percent_name, Spackage_percent_name, 1, 1, 0, (Lisp_Object package) { CHECK_PACKAGE (package); - return XPACKAGE (package)->name; + return PACKAGE_NAMEX (package); } DEFUN ("package-%set-name", Fpackage_percent_set_name, Spackage_percent_set_name, diff --git a/src/print.c b/src/print.c index e76bd44a82f..af23aade6f7 100644 --- a/src/print.c +++ b/src/print.c @@ -1804,10 +1804,10 @@ print_vectorlike (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag, break; case PVEC_PACKAGE: - if (STRINGP (XPACKAGE (obj)->name)) + if (STRINGP (PACKAGE_NAMEX (obj))) { print_c_string ("#name, printcharfun); + print_string (PACKAGE_NAMEX (obj), printcharfun); print_c_string ("\">", printcharfun); } else @@ -2240,8 +2240,7 @@ print_symbol (Lisp_Object symbol, Lisp_Object printcharfun, const bool accessible = !EQ (found, Qunbound); if (!accessible || !EQ (found, symbol)) { - print_symbol_name (XPACKAGE (package)->name, - printcharfun, escape); + print_symbol_name (PACKAGE_NAMEX (package), printcharfun, escape); const Lisp_Object found = pkg_find_symbol (name, package, &status); eassert (!EQ (found, Qunbound)); if (EQ (status, QCexternal)) -- 2.39.2