Move error codes to separate header file
This commit is contained in:
parent
3f6acc9f42
commit
61e4168fbc
|
@ -6,6 +6,7 @@
|
|||
/* convert.h - character set conversion routines. */
|
||||
|
||||
#include "lib/defs.h"
|
||||
#include "lib/error.h"
|
||||
|
||||
enum {
|
||||
/* Constants for CR and LF. Note that we should not use '\n' or '\r'
|
||||
|
|
|
@ -12,6 +12,7 @@ cc_library(
|
|||
"crc32.h",
|
||||
"defs.h",
|
||||
"endian.h",
|
||||
"error.h",
|
||||
"util.h",
|
||||
],
|
||||
copts = COPTS,
|
||||
|
|
19
lib/defs.h
19
lib/defs.h
|
@ -90,25 +90,6 @@ typedef long Size;
|
|||
|
||||
#endif
|
||||
|
||||
// =============================================================================
|
||||
// Error codes and error reporting
|
||||
// =============================================================================
|
||||
|
||||
// Error codes.
|
||||
typedef enum {
|
||||
// No error (success). Equal to 0.
|
||||
kErrorOK,
|
||||
|
||||
// Memory allocation failed.
|
||||
kErrorNoMemory,
|
||||
|
||||
// Invaild table data.
|
||||
kErrorBadData,
|
||||
|
||||
// Too many files in one directory.
|
||||
kErrorDirectoryTooLarge
|
||||
} ErrorCode;
|
||||
|
||||
// =============================================================================
|
||||
// Memory allocation
|
||||
// =============================================================================
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright 2022 Dietrich Epp.
|
||||
// This file is part of SyncFiles. SyncFiles is licensed under the terms of the
|
||||
// Mozilla Public License, version 2.0. See LICENSE.txt for details.
|
||||
#ifndef LIB_ERROR_H
|
||||
#define LIB_ERROR_H
|
||||
|
||||
// Error codes.
|
||||
typedef enum {
|
||||
// No error (success). Equal to 0.
|
||||
kErrorOK,
|
||||
|
||||
// Memory allocation failed.
|
||||
kErrorNoMemory,
|
||||
|
||||
// Invaild table data.
|
||||
kErrorBadData,
|
||||
|
||||
// Too many files in one directory.
|
||||
kErrorDirectoryTooLarge,
|
||||
} ErrorCode;
|
||||
|
||||
#endif
|
|
@ -6,6 +6,7 @@
|
|||
// test.h - unit testing definitions.
|
||||
|
||||
#include "lib/defs.h"
|
||||
#include "lib/error.h"
|
||||
|
||||
// The number of test failures.
|
||||
extern int gFailCount;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
// Mozilla Public License, version 2.0. See LICENSE.txt for details.
|
||||
#ifndef LIB_UTIL_H
|
||||
#define LIB_UTIL_H
|
||||
#include "lib/defs.h"
|
||||
#include "lib/error.h"
|
||||
|
||||
// Print an error message and exit.
|
||||
void Fatalf(const char *msg, ...)
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
// Mozilla Public License, version 2.0. See LICENSE.txt for details.
|
||||
#include "sync/tree.h"
|
||||
|
||||
#include "lib/error.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#define GetNode(nodes, ref) ((nodes) + (ref)-1)
|
||||
|
|
Loading…
Reference in New Issue