1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-28 07:21:54 +03:00

smbd: Use ISDOT/ISDOTDOT in ReadDirName()

With those macros, we check n[0] twice now, but I think the compiler
should either optimize that out or if it can't this will be in the CPU
cache, so the second check should be practially free. I can't imagine
this makes any difference but the better readability.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Volker Lendecke 2022-03-12 12:47:54 +01:00 committed by Jeremy Allison
parent 3505285c8f
commit a0c897ba20

View File

@ -1627,11 +1627,9 @@ const char *ReadDirName(struct smb_Dir *dir_hnd, long *poffset,
while ((n = vfs_readdirname(conn, dir_hnd->fsp, dir_hnd->dir, sbuf, &talloced))) {
/* Ignore . and .. - we've already returned them. */
if (*n == '.') {
if ((n[1] == '\0') || (n[1] == '.' && n[2] == '\0')) {
TALLOC_FREE(talloced);
continue;
}
if (ISDOT(n) || ISDOTDOT(n)) {
TALLOC_FREE(talloced);
continue;
}
*poffset = dir_hnd->offset = SMB_VFS_TELLDIR(conn, dir_hnd->dir);
*ptalloced = talloced;