Welcome to little lamb

Code » limb » commit 527248b

direntry.h: Rename sascandir* to sa_scandir*

author Olivier Brunel
2023-07-02 13:11:10 UTC
committer Olivier Brunel
2023-07-24 10:16:42 UTC
parent 535b2deea5c6bed79a1958af44e06268e4e6f57f

direntry.h: Rename sascandir* to sa_scandir*

For consistency with other suchly named functions.

src/doc/direntry.h.0.md +3 -3
src/doc/direntry.h/sa_scandir.3.md +1 -0
src/doc/direntry.h/{sascandirat.3.md => sa_scandirat.3.md} +8 -8
src/liblimb/direntry.h/{sascandirat.c => sa_scandirat.c} +1 -1
src/liblimb/djbunix.h/salsat.c +2 -2
src/liblimb/include/limb/direntry.h +3 -3

diff --git a/src/doc/direntry.h.0.md b/src/doc/direntry.h.0.md
index 8e42176..9911b71 100644
--- a/src/doc/direntry.h.0.md
+++ b/src/doc/direntry.h.0.md
@@ -44,8 +44,8 @@ The following functions are defined :
 : [dir_fd](3)
 :: Similar to [dirfd](3)
 
-: [sascandirat](3)
+: [sa_scandirat](3)
 :: Scan a directory to fill a *stralloc*.
 
-: [sascandir](3)
-:: Similar to [sascandirat](3) except for relative path.
+: [sa_scandir](3)
+:: Similar to [sa_scandirat](3) except for relative path.
diff --git a/src/doc/direntry.h/sa_scandir.3.md b/src/doc/direntry.h/sa_scandir.3.md
new file mode 120000
index 0000000..949cfe0
--- /dev/null
+++ b/src/doc/direntry.h/sa_scandir.3.md
@@ -0,0 +1 @@
+sa_scandirat.3.md
\ No newline at end of file
diff --git a/src/doc/direntry.h/sascandirat.3.md b/src/doc/direntry.h/sa_scandirat.3.md
similarity index 60%
rename from src/doc/direntry.h/sascandirat.3.md
rename to src/doc/direntry.h/sa_scandirat.3.md
index da39747..40a58c4 100644
--- a/src/doc/direntry.h/sascandirat.3.md
+++ b/src/doc/direntry.h/sa_scandirat.3.md
@@ -1,9 +1,9 @@
 % limb manual
-% sascandirat(3)
+% sa_scandirat(3)
 
 # NAME
 
-sascandirat, sascandir - scan a directory to fill a stralloc
+sa_scandirat, sa_scandir - scan a directory to fill a stralloc
 
 # SYNOPSIS
 
@@ -11,18 +11,18 @@ sascandirat, sascandir - scan a directory to fill a stralloc
     #include <limb/direntry.h>
 
 ```pre hl
-typedef ssize_t (*sascande) (stralloc *<em>sa</em>, direntry *<em>de</em>, int <em>dirfd</em>, void *<em>ctx</em>)
+typedef ssize_t (*sa_scande) (stralloc *<em>sa</em>, direntry *<em>de</em>, int <em>dirfd</em>, void *<em>ctx</em>)
 
-int sascandirat(stralloc *<em>sa</em>, int <em>dirfd</em>, const char *<em>name</em>, sascande <em>fn</em>, void *<em>ctx</em>)
-int sascandir(stralloc *<em>sa</em>, const char *<em>name</em>, sascande <em>fn</em>, void *<em>ctx</em>)
+int sa_scandirat(stralloc *<em>sa</em>, int <em>dirfd</em>, const char *<em>name</em>, sa_scande <em>fn</em>, void *<em>ctx</em>)
+int sa_scandir(stralloc *<em>sa</em>, const char *<em>name</em>, sa_scande <em>fn</em>, void *<em>ctx</em>)
 ```
 
 # DESCRIPTION
 
-The `sascandirat`() function scans the directory `name` calling the function
+The `sa_scandirat`() function scans the directory `name` calling the function
 `fn` on each of its directory entry, save for `.` and `..` which are ignored.
 Said function shall add relevant information regarding the directory entry
-pointed by `de` into the stralloc pointed by `sa` and return 1 on success. It
+pointed by `de` into the *stralloc* pointed by `sa` and return 1 on success. It
 can also return 0 if nothing was added, e.g. the file/entry was simply ignored.
 In case of failure it must return -1 and set `errno` to indicate the error.
 
@@ -30,7 +30,7 @@ If `name` describes a relative path, it is relative to the directory associated
 with the file descriptor `dirfd`, which may be *AT_FDCWD* to use the current
 working directory.
 
-The `sascandir`() macro is similar, except when `name` describes a relative
+The `sa_scandir`() macro is similar, except when `name` describes a relative
 path, in which case it is relative to the current working directory.
 
 # RETURN VALUE
diff --git a/src/liblimb/direntry.h/sascandirat.c b/src/liblimb/direntry.h/sa_scandirat.c
similarity index 89%
rename from src/liblimb/direntry.h/sascandirat.c
rename to src/liblimb/direntry.h/sa_scandirat.c
index 1a90b33..d9d5754 100644
--- a/src/liblimb/direntry.h/sascandirat.c
+++ b/src/liblimb/direntry.h/sa_scandirat.c
@@ -5,7 +5,7 @@
 #include <limb/direntry.h>
 
 int
-sascandirat(stralloc *sa, int bfd, const char *name, sascande fn, void *ctx)
+sa_scandirat(stralloc *sa, int bfd, const char *name, sa_scande fn, void *ctx)
 {
     size_t salen = sa->len;
     int ret = 0;
diff --git a/src/liblimb/djbunix.h/salsat.c b/src/liblimb/djbunix.h/salsat.c
index 223073d..a96bd96 100644
--- a/src/liblimb/djbunix.h/salsat.c
+++ b/src/liblimb/djbunix.h/salsat.c
@@ -7,7 +7,7 @@
 #include <limb/gccattributes.h>
 
 static ssize_t
-sascandir_name(stralloc *sa, direntry *de, int bfd gccattr_unused, void *mlen_)
+sa_scandir_name(stralloc *sa, direntry *de, int bfd gccattr_unused, void *mlen_)
 {
     size_t *mlen = mlen_;
     size_t len = strlen(de->d_name);
@@ -22,5 +22,5 @@ int
 salsat(int fd, const char *name, stralloc *sa, size_t *mlen)
 {
     if (mlen) *mlen = 0;
-    return sascandirat(sa, fd, name, sascandir_name, mlen);
+    return sa_scandirat(sa, fd, name, sa_scandir_name, mlen);
 }
diff --git a/src/liblimb/include/limb/direntry.h b/src/liblimb/include/limb/direntry.h
index cc4a8f5..4daa44d 100644
--- a/src/liblimb/include/limb/direntry.h
+++ b/src/liblimb/include/limb/direntry.h
@@ -7,13 +7,13 @@
 #include <skalibs/direntry.h>
 #include <limb/stralloc.h>
 
-typedef ssize_t (*sascande) (stralloc *sa, direntry *de, int bfd, void *ctx);
+typedef ssize_t (*sa_scande) (stralloc *sa, direntry *de, int bfd, void *ctx);
 
 #define ISDOTDOT(de)    ((de)->d_name[0] == '.' && (!(de)->d_name[1] || ((de)->d_name[1] == '.' && !(de)->d_name[2])))
 
 extern DIR *opendirat(int bfd, const char *name);
 
-extern int sascandirat(stralloc *sa, int bfd, const char *name, sascande fn, void *ctx);
-#define sascandir(sa,name,fn,ctx)   sascandirat(sa, AT_FDCWD, name, fn, ctx)
+extern int sa_scandirat(stralloc *sa, int bfd, const char *name, sa_scande fn, void *ctx);
+#define sa_scandir(sa,name,fn,ctx)  sa_scandirat(sa, AT_FDCWD, name, fn, ctx)
 
 #endif /* LIMB_DIRENTRY_H */