emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[nongnu] elpa/xml-rpc a190759da8 41/64: Merge pull request #2 from mdorm


From: Stefan Kangas
Subject: [nongnu] elpa/xml-rpc a190759da8 41/64: Merge pull request #2 from mdorman/master
Date: Fri, 31 Dec 2021 20:11:08 -0500 (EST)

branch: elpa/xml-rpc
commit a190759da8765d3b22ceb6774cefc610fda404d8
Merge: 7a4ea6c22e e4002b8502
Author: Mark A. Hershberger <mah@everybody.org>
Commit: Mark A. Hershberger <mah@everybody.org>

    Merge pull request #2 from mdorman/master
    
    Fix struct recognition
---
 xml-rpc-test.el | 10 ++++++++++
 xml-rpc.el      | 16 +++++++++++++++-
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/xml-rpc-test.el b/xml-rpc-test.el
new file mode 100644
index 0000000000..c84c47a728
--- /dev/null
+++ b/xml-rpc-test.el
@@ -0,0 +1,10 @@
+(require 'ert)
+
+(load-file "xml-rpc.el")
+
+(ert-deftest test-xml-rpc-value-structp ()
+  "Test whether xml-rpc-value-structp operates correctly"
+  (should (eq (xml-rpc-value-structp ()) t))
+  (should (eq (xml-rpc-value-structp '(("foo"))) t))
+  (should (eq (xml-rpc-value-structp '(("foo" . "bar"))) t))
+  (should (eq (xml-rpc-value-structp '(("foo" :datetime (12345 12345)))) t)))
diff --git a/xml-rpc.el b/xml-rpc.el
index 984ebe9408..33dc07d933 100644
--- a/xml-rpc.el
+++ b/xml-rpc.el
@@ -252,6 +252,20 @@ Set it higher to get some info in the *Messages* buffer"
   "A list of extra headers to send with the next request.
 Should be an assoc list of headers/contents.  See `url-request-extra-headers'")
 
+(defsubst xml-rpc-valuep (value)
+  "Return t if VALUE is any sort of xml-rpc structure.
+
+Return nil otherwise."
+  (or (xml-rpc-value-intp value)
+      (xml-rpc-value-doublep value)
+      (xml-rpc-value-stringp value)
+      (xml-rpc-value-structp value)
+      (xml-rpc-value-arrayp value)
+      (xml-rpc-value-vectorp value)
+      (xml-rpc-value-booleanp value)
+      (xml-rpc-value-datetimep value)
+      (xml-rpc-value-base64p value)))
+
 ;;
 ;; Value type handling functions
 ;;
@@ -281,7 +295,7 @@ Should be an assoc list of headers/contents.  See 
`url-request-extra-headers'")
                          (setq curval (car-safe vals))
                          (consp curval)
                          (stringp (car-safe curval))
-                         (not (listp (cdr curval)))))
+                         (xml-rpc-valuep (cdr curval))))
            (setq vals (cdr-safe vals)))
          result)))
 



reply via email to

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