From: Bruno Haible Date: Tue, 29 Apr 2025 22:37:08 +0000 (+0200) Subject: Rename module hash-triple to hashcode-file-inode. X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=53cea75d3d378c7a71fa16ff01def1edfdf9cb55;p=gnulib.git Rename module hash-triple to hashcode-file-inode. * lib/hashcode-file-inode.c: Renamed from lib/hash-triple.c. * modules/hashcode-file-inode: Renamed from modules/hash-triple. * modules/hash-triple: New file. * lib/hash-triple.h: Update. * MODULES.html.sh: Update. --- diff --git a/ChangeLog b/ChangeLog index a8112663f0..44e143f459 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2025-04-29 Bruno Haible + Rename module hash-triple to hashcode-file-inode. + * lib/hashcode-file-inode.c: Renamed from lib/hash-triple.c. + * modules/hashcode-file-inode: Renamed from modules/hash-triple. + * modules/hash-triple: New file. + * lib/hash-triple.h: Update. + * MODULES.html.sh: Update. + Rename module hash-triple-simple to hashcode-named-file. * lib/hashcode-named-file.c: Renamed from lib/hash-triple-simple.c. * modules/hashcode-named-file: Renamed from modules/hash-triple-simple. diff --git a/MODULES.html.sh b/MODULES.html.sh index c80ea9d7a2..baee4f95fd 100755 --- a/MODULES.html.sh +++ b/MODULES.html.sh @@ -2870,7 +2870,7 @@ func_all_modules () func_module cycle-check func_module dev-ino func_module file-set - func_module hash-triple + func_module hashcode-file-inode func_module i-ring func_module same-inode func_end_table diff --git a/lib/hash-triple.c b/lib/hash-triple.c deleted file mode 100644 index 5d47e58fb4..0000000000 --- a/lib/hash-triple.c +++ /dev/null @@ -1,44 +0,0 @@ -/* Hash functions for file-related triples: name, device, inode. - Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -/* written by Jim Meyering */ - -#include - -/* Specification. */ -#include "hash-triple.h" - -#include "same.h" -#include "same-inode.h" - -/* Hash an F_triple, without considering the file name. */ -size_t -triple_hash_no_name (void const *x, size_t table_size) -{ - struct F_triple const *p = x; - - /* Ignoring the device number here should be fine. */ - return p->st_ino % table_size; -} - -/* Compare two F_triple structs. */ -bool -triple_compare (void const *x, void const *y) -{ - struct F_triple const *a = x; - struct F_triple const *b = y; - return PSAME_INODE (a, b) && same_name (a->name, b->name); -} diff --git a/lib/hash-triple.h b/lib/hash-triple.h index 1e59be64ba..26ef7a1f05 100644 --- a/lib/hash-triple.h +++ b/lib/hash-triple.h @@ -47,7 +47,7 @@ extern bool triple_compare_ino_str (void const *x, void const *y) _GL_ATTRIBUTE_PURE; extern void triple_free (void *x); -/* Defined in module 'hash-triple'. */ +/* Defined in module 'hashcode-file-inode'. */ extern size_t triple_hash_no_name (void const *x, size_t table_size) _GL_ATTRIBUTE_PURE; extern bool triple_compare (void const *x, void const *y); diff --git a/lib/hashcode-file-inode.c b/lib/hashcode-file-inode.c new file mode 100644 index 0000000000..5d47e58fb4 --- /dev/null +++ b/lib/hashcode-file-inode.c @@ -0,0 +1,44 @@ +/* Hash functions for file-related triples: name, device, inode. + Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* written by Jim Meyering */ + +#include + +/* Specification. */ +#include "hash-triple.h" + +#include "same.h" +#include "same-inode.h" + +/* Hash an F_triple, without considering the file name. */ +size_t +triple_hash_no_name (void const *x, size_t table_size) +{ + struct F_triple const *p = x; + + /* Ignoring the device number here should be fine. */ + return p->st_ino % table_size; +} + +/* Compare two F_triple structs. */ +bool +triple_compare (void const *x, void const *y) +{ + struct F_triple const *a = x; + struct F_triple const *b = y; + return PSAME_INODE (a, b) && same_name (a->name, b->name); +} diff --git a/modules/hash-triple b/modules/hash-triple index f908f10949..5c446cbe34 100644 --- a/modules/hash-triple +++ b/modules/hash-triple @@ -1,18 +1,20 @@ Description: Hash functions for file-related triples: name, device, inode. +Status: +deprecated + +Notice: +This module is deprecated. Use the module 'hashcode-file-inode' instead. + Files: -lib/hash-triple.c Depends-on: -hashcode-named-file -same -same-inode +hashcode-file-inode configure.ac: Makefile.am: -lib_SOURCES += hash-triple.c Include: "hash-triple.h" @@ -21,4 +23,3 @@ License: GPL Maintainer: -Jim Meyering diff --git a/modules/hashcode-file-inode b/modules/hashcode-file-inode new file mode 100644 index 0000000000..87d2d41486 --- /dev/null +++ b/modules/hashcode-file-inode @@ -0,0 +1,24 @@ +Description: +Hash functions for file-related triples: name, device, inode. + +Files: +lib/hashcode-file-inode.c + +Depends-on: +hashcode-named-file +same +same-inode + +configure.ac: + +Makefile.am: +lib_SOURCES += hashcode-file-inode.c + +Include: +"hash-triple.h" + +License: +GPL + +Maintainer: +Jim Meyering