aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2025-12-07 23:39:35 -0800
committerPaul Eggert2025-12-07 23:40:12 -0800
commit24297f6d9a2fb3bf464f25bdf80c85b13aa04a36 (patch)
tree3ffdbed7421a73f39874cd76473b6aaf60369c56
parentddf297068c1b899717f7c97d8f9a81f86ecaf3b3 (diff)
downloademacs-24297f6d9a2fb3bf464f25bdf80c85b13aa04a36.tar.gz
emacs-24297f6d9a2fb3bf464f25bdf80c85b13aa04a36.zip
Simplify conv_sockaddr_to_lisp via strnlen
* src/process.c (conv_sockaddr_to_lisp): Use strnlen rather than a circumlocution.
-rw-r--r--src/process.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/src/process.c b/src/process.c
index 3d4ecb82b08..3091dd99822 100644
--- a/src/process.c
+++ b/src/process.c
@@ -2635,13 +2635,7 @@ conv_sockaddr_to_lisp (struct sockaddr *sa, ptrdiff_t len)
2635 to walk past the end of the object looking for the name 2635 to walk past the end of the object looking for the name
2636 terminator, however. */ 2636 terminator, however. */
2637 if (name_length > 0 && sockun->sun_path[0] != '\0') 2637 if (name_length > 0 && sockun->sun_path[0] != '\0')
2638 { 2638 name_length = strnlen (sockun->sun_path, name_length);
2639 const char *terminator
2640 = memchr (sockun->sun_path, '\0', name_length);
2641
2642 if (terminator)
2643 name_length = terminator - (const char *) sockun->sun_path;
2644 }
2645 2639
2646 return make_unibyte_string (sockun->sun_path, name_length); 2640 return make_unibyte_string (sockun->sun_path, name_length);
2647 } 2641 }