diff options
| author | Congcong Kuo <congcong.kuo@gmail.com> | 2025-10-20 11:39:00 +0800 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2025-11-12 18:34:06 +0100 |
| commit | d1a9fb85a4d46722f06d01bde6f61acae3d9ea7a (patch) | |
| tree | 30aeae6c569b01d614ecc38a3e4eb86321a53ecd /nix/nix-daemon | |
| parent | 6fe5e7f70714735a7a365c73965fc0bfdb3f9f31 (diff) | |
daemon: Use inline functions and variables instead of extern
Avoid separate declarations and definitions for so-called 'global' objects.
* nix/libstore/derivations.{cc, hh} (drvHashes): Use inline instead of separate
declaration and definition.
* nix/libstore/globals.{cc, hh} (settings, nixVersion): Same.
* nix/libstore/local-store.hh (drvsLogDir, deduplicationMinSize): Same.
* nix/libstore/optimise-store.cc (deduplicationMinSize): Same.
* nix/libstore/store-api.{cc, hh} (store): Same.
* nix/libutil/archive.{cc, hh} (defaultPathFilter): Same.
* nix/libutil/hash.{cc, hh} (base32Chars): Same and modify header files.
* nix/libutil/util.{cc, hh} (logType, verbosity, _writeToStderr,
_isInterrupted): Same.
* nix/local.mk: Modified according to the rename of shared.hh.
* nix/nix-daemon/guix-daemon.cc (blockInt, argvSaved, run): Same and
modify header files.
* nix/nix-daemon/nix-daemon.cc: Modify header files.
* nix/nix-daemon/shared.hh: Renamed to nix-daemon.hh
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'nix/nix-daemon')
| -rw-r--r-- | nix/nix-daemon/guix-daemon.cc | 17 | ||||
| -rw-r--r-- | nix/nix-daemon/nix-daemon.cc | 2 | ||||
| -rw-r--r-- | nix/nix-daemon/nix-daemon.hh (renamed from nix/nix-daemon/shared.hh) | 9 |
3 files changed, 13 insertions, 15 deletions
diff --git a/nix/nix-daemon/guix-daemon.cc b/nix/nix-daemon/guix-daemon.cc index af09839932f..341e39c2907 100644 --- a/nix/nix-daemon/guix-daemon.cc +++ b/nix/nix-daemon/guix-daemon.cc | |||
| @@ -17,12 +17,12 @@ | |||
| 17 | You should have received a copy of the GNU General Public License | 17 | You should have received a copy of the GNU General Public License |
| 18 | along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. */ | 18 | along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. */ |
| 19 | 19 | ||
| 20 | #include <config.h> | 20 | #include "config.h" |
| 21 | 21 | ||
| 22 | #include <types.hh> | 22 | #include "types.hh" |
| 23 | #include "shared.hh" | 23 | #include "nix-daemon.hh" |
| 24 | #include <globals.hh> | 24 | #include "globals.hh" |
| 25 | #include <util.hh> | 25 | #include "util.hh" |
| 26 | 26 | ||
| 27 | #include <gcrypt.h> | 27 | #include <gcrypt.h> |
| 28 | 28 | ||
| @@ -36,20 +36,13 @@ | |||
| 36 | #include <netdb.h> | 36 | #include <netdb.h> |
| 37 | #include <strings.h> | 37 | #include <strings.h> |
| 38 | #include <exception> | 38 | #include <exception> |
| 39 | #include <iostream> | ||
| 40 | #include <format> | 39 | #include <format> |
| 41 | 40 | ||
| 42 | #include <libintl.h> | 41 | #include <libintl.h> |
| 43 | #include <locale.h> | 42 | #include <locale.h> |
| 44 | 43 | ||
| 45 | /* Variables used by `nix-daemon.cc'. */ | ||
| 46 | volatile ::sig_atomic_t blockInt; | ||
| 47 | char **argvSaved; | ||
| 48 | |||
| 49 | using namespace nix; | 44 | using namespace nix; |
| 50 | 45 | ||
| 51 | /* Entry point in `nix-daemon.cc'. */ | ||
| 52 | extern void run (const std::vector<int> &); | ||
| 53 | 46 | ||
| 54 | 47 | ||
| 55 | /* Command-line options. */ | 48 | /* Command-line options. */ |
diff --git a/nix/nix-daemon/nix-daemon.cc b/nix/nix-daemon/nix-daemon.cc index 3890adb2c74..b3cdb699ac2 100644 --- a/nix/nix-daemon/nix-daemon.cc +++ b/nix/nix-daemon/nix-daemon.cc | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | #include "config.h" | 1 | #include "config.h" |
| 2 | #include "shared.hh" | 2 | #include "nix-daemon.hh" |
| 3 | #include "local-store.hh" | 3 | #include "local-store.hh" |
| 4 | #include "util.hh" | 4 | #include "util.hh" |
| 5 | #include "serialise.hh" | 5 | #include "serialise.hh" |
diff --git a/nix/nix-daemon/shared.hh b/nix/nix-daemon/nix-daemon.hh index 98ec97410b7..8791c4f21fd 100644 --- a/nix/nix-daemon/shared.hh +++ b/nix/nix-daemon/nix-daemon.hh | |||
| @@ -20,9 +20,14 @@ | |||
| 20 | 20 | ||
| 21 | #pragma once | 21 | #pragma once |
| 22 | 22 | ||
| 23 | #include <vector> | ||
| 24 | |||
| 23 | #include <stdlib.h> | 25 | #include <stdlib.h> |
| 24 | #include <signal.h> | 26 | #include <signal.h> |
| 25 | 27 | ||
| 26 | extern volatile ::sig_atomic_t blockInt; | 28 | /* Variables used by `nix-daemon.cc'. */ |
| 29 | inline volatile ::sig_atomic_t blockInt; | ||
| 30 | inline char **argvSaved; | ||
| 27 | 31 | ||
| 28 | extern char **argvSaved; | 32 | /* Entry point in `nix-daemon.cc'. */ |
| 33 | void run (const std::vector<int> &); | ||
