]> git.eshelyaron.com Git - emacs.git/commitdiff
Minor adjustments to last change
authorPo Lu <luangruo@yahoo.com>
Sat, 23 Mar 2024 10:12:56 +0000 (18:12 +0800)
committerEshel Yaron <me@eshelyaron.com>
Sun, 24 Mar 2024 14:21:06 +0000 (15:21 +0100)
* src/androidvfs.c (android_vfs_convert_name): Simplify.
(android_saf_tree_readdir, android_root_name): Remove redundant
statements.

(cherry picked from commit 023a5fe5a3bd2f20eb168bc4763fa98e14201fff)

src/androidvfs.c

index 6a9ddb33c563d3253967d243b53a6884e6227f13..a9035ae53c66bddeae5ff28ae7766475ccb62d4e 100644 (file)
@@ -5553,7 +5553,6 @@ android_saf_tree_readdir (struct android_vdir *vdir)
                                              chars);
 
   /* Resize dirent to accommodate the decoded text.  */
-  length = strlen (chars) + 1;
   size   = offsetof (struct dirent, d_name) + 1 + coding.produced;
   dirent = xrealloc (dirent, size);
 
@@ -6573,15 +6572,11 @@ static struct android_special_vnode special_vnodes[] =
 static Lisp_Object
 android_vfs_convert_name (const char *name, Lisp_Object coding)
 {
-  Lisp_Object src_coding, name1;
-
-  src_coding = Qutf_8_emacs;
+  Lisp_Object name1;
 
-  /* Convert the contents of the buffer after BUFFER_END
-     from the file name coding system to
-     special->special_coding_system.  */
-  AUTO_STRING (file_name, name);
-  name1 = code_convert_string_norecord (file_name, src_coding, false);
+  /* Convert the contents of the buffer after BUFFER_END from the file
+     name coding system to special->special_coding_system.  */
+  name1 = build_string (name);
   name1 = code_convert_string (name1, coding, Qt, true, true, true);
   return name1;
 }
@@ -6632,7 +6627,7 @@ android_root_name (struct android_vnode *vnode, char *name,
 
              /* Allocate a buffer and copy file_name into the same.  */
              length = SBYTES (file_name) + 1;
-             name = SAFE_ALLOCA (length + 1);
+             name = SAFE_ALLOCA (length);
 
              /* Copy the trailing NULL byte also.  */
              memcpy (name, SDATA (file_name), length);
@@ -6662,7 +6657,7 @@ android_root_name (struct android_vnode *vnode, char *name,
 
              /* Allocate a buffer and copy file_name into the same.  */
              length = SBYTES (file_name) + 1;
-             name = SAFE_ALLOCA (length + 1);
+             name = SAFE_ALLOCA (length);
 
              /* Copy the trailing NULL byte also.  */
              memcpy (name, SDATA (file_name), length);