Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
8257a3c1
Commit
8257a3c1
authored
May 05, 2020
by
antirez
Browse files
Move CRC64 initialization in main().
parent
1063f1d8
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/crc64.c
View file @
8257a3c1
...
@@ -29,7 +29,6 @@
...
@@ -29,7 +29,6 @@
#include "crc64.h"
#include "crc64.h"
#include "crcspeed.h"
#include "crcspeed.h"
static
uint64_t
crc64_table
[
8
][
256
]
=
{{
0
}};
static
uint64_t
crc64_table
[
8
][
256
]
=
{{
0
}};
static
int
crc64_table_initialized
=
0
;
#define POLY UINT64_C(0xad93d23594c935a9)
#define POLY UINT64_C(0xad93d23594c935a9)
/******************** BEGIN GENERATED PYCRC FUNCTIONS ********************/
/******************** BEGIN GENERATED PYCRC FUNCTIONS ********************/
...
@@ -116,12 +115,10 @@ uint64_t _crc64(uint_fast64_t crc, const void *in_data, const uint64_t len) {
...
@@ -116,12 +115,10 @@ uint64_t _crc64(uint_fast64_t crc, const void *in_data, const uint64_t len) {
/* Initializes the 16KB lookup tables. */
/* Initializes the 16KB lookup tables. */
void
crc64_init
(
void
)
{
void
crc64_init
(
void
)
{
crcspeed64native_init
(
_crc64
,
crc64_table
);
crcspeed64native_init
(
_crc64
,
crc64_table
);
crc64_table_initialized
=
1
;
}
}
/* Compute crc64 */
/* Compute crc64 */
uint64_t
crc64
(
uint64_t
crc
,
const
unsigned
char
*
s
,
uint64_t
l
)
{
uint64_t
crc64
(
uint64_t
crc
,
const
unsigned
char
*
s
,
uint64_t
l
)
{
if
(
!
crc64_table_initialized
)
crc64_init
();
return
crcspeed64native
(
crc64_table
,
crc
,
(
void
*
)
s
,
l
);
return
crcspeed64native
(
crc64_table
,
crc
,
(
void
*
)
s
,
l
);
}
}
...
...
src/server.c
View file @
8257a3c1
...
@@ -2899,7 +2899,6 @@ void initServer(void) {
...
@@ -2899,7 +2899,6 @@ void initServer(void) {
scriptingInit
(
1
);
scriptingInit
(
1
);
slowlogInit
();
slowlogInit
();
latencyMonitorInit
();
latencyMonitorInit
();
crc64_init
();
}
}
/* Some steps in server initialization need to be done last (after modules
/* Some steps in server initialization need to be done last (after modules
...
@@ -4963,6 +4962,7 @@ int main(int argc, char **argv) {
...
@@ -4963,6 +4962,7 @@ int main(int argc, char **argv) {
zmalloc_set_oom_handler
(
redisOutOfMemoryHandler
);
zmalloc_set_oom_handler
(
redisOutOfMemoryHandler
);
srand
(
time
(
NULL
)
^
getpid
());
srand
(
time
(
NULL
)
^
getpid
());
gettimeofday
(
&
tv
,
NULL
);
gettimeofday
(
&
tv
,
NULL
);
crc64_init
();
uint8_t
hashseed
[
16
];
uint8_t
hashseed
[
16
];
getRandomBytes
(
hashseed
,
sizeof
(
hashseed
));
getRandomBytes
(
hashseed
,
sizeof
(
hashseed
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment