forked from github/server
use mtype->key instead of repeated hashstring calls.
This commit is contained in:
parent
452614307d
commit
9baba00087
2 changed files with 4 additions and 4 deletions
|
@ -81,7 +81,7 @@ static crmessage_type *crtypes[CRMAXHASH];
|
||||||
|
|
||||||
static crmessage_type *crt_find(const struct message_type *mtype)
|
static crmessage_type *crt_find(const struct message_type *mtype)
|
||||||
{
|
{
|
||||||
unsigned int hash = hashstring(mtype->name) % CRMAXHASH;
|
unsigned int hash = mtype->key % CRMAXHASH;
|
||||||
crmessage_type *found = NULL;
|
crmessage_type *found = NULL;
|
||||||
crmessage_type *type = crtypes[hash];
|
crmessage_type *type = crtypes[hash];
|
||||||
while (type) {
|
while (type) {
|
||||||
|
@ -94,7 +94,7 @@ static crmessage_type *crt_find(const struct message_type *mtype)
|
||||||
|
|
||||||
void crt_register(const struct message_type *mtype)
|
void crt_register(const struct message_type *mtype)
|
||||||
{
|
{
|
||||||
unsigned int hash = hashstring(mtype->name) % CRMAXHASH;
|
unsigned int hash = mtype->key % CRMAXHASH;
|
||||||
crmessage_type *crt = crtypes[hash];
|
crmessage_type *crt = crtypes[hash];
|
||||||
while (crt && crt->mtype != mtype) {
|
while (crt && crt->mtype != mtype) {
|
||||||
crt = crt->next;
|
crt = crt->next;
|
||||||
|
|
|
@ -40,7 +40,7 @@ nrmessage_type *nrt_find(const struct locale * lang,
|
||||||
const struct message_type * mtype)
|
const struct message_type * mtype)
|
||||||
{
|
{
|
||||||
nrmessage_type *found = NULL;
|
nrmessage_type *found = NULL;
|
||||||
unsigned int hash = hashstring(mtype->name) % NRT_MAXHASH;
|
unsigned int hash = mtype->key % NRT_MAXHASH;
|
||||||
nrmessage_type *type = nrtypes[hash];
|
nrmessage_type *type = nrtypes[hash];
|
||||||
while (type) {
|
while (type) {
|
||||||
if (type->mtype == mtype) {
|
if (type->mtype == mtype) {
|
||||||
|
@ -101,7 +101,7 @@ void
|
||||||
nrt_register(const struct message_type *mtype, const struct locale *lang,
|
nrt_register(const struct message_type *mtype, const struct locale *lang,
|
||||||
const char *string, int level, const char *section)
|
const char *string, int level, const char *section)
|
||||||
{
|
{
|
||||||
unsigned int hash = hashstring(mtype->name) % NRT_MAXHASH;
|
unsigned int hash = mtype->key % NRT_MAXHASH;
|
||||||
nrmessage_type *nrt = nrtypes[hash];
|
nrmessage_type *nrt = nrtypes[hash];
|
||||||
while (nrt && (nrt->lang != lang || nrt->mtype != mtype)) {
|
while (nrt && (nrt->lang != lang || nrt->mtype != mtype)) {
|
||||||
nrt = nrt->next;
|
nrt = nrt->next;
|
||||||
|
|
Loading…
Reference in a new issue