Commit df1f22ed authored by Andreas Marek's avatar Andreas Marek

Merge branch 'loh/fix_elpa_index' into 'master_pre_stage'

loh/fix elpa index

See merge request !10
parents 718e7b89 fd2bb65c
......@@ -49,8 +49,6 @@
#include <elpa/elpa.h>
#include "elpa_index.h"
#include <execinfo.h>
#include "config.h"
#ifdef WITH_OPENMP
......@@ -268,27 +266,17 @@ void elpa_index_free(elpa_index_t index) {
free(index);
}
static int compar(const void *key, const void *member) {
const char *name = (const char *) key;
elpa_index_int_entry_t *entry = (elpa_index_int_entry_t *) member;
int l1 = strlen(entry->base.name);
int l2 = strlen(name);
if (l1 != l2) {
return 1;
}
if (strncmp(name, entry->base.name, l1) == 0) {
return 0;
} else {
return 1;
}
static int compar(const void *a, const void *b) {
return strcmp(((elpa_index_int_entry_t *) a)->base.name,
((elpa_index_int_entry_t *) b)->base.name);
}
#define IMPLEMENT_FIND_ENTRY(TYPE, ...) \
static int find_##TYPE##_entry(char *name) { \
elpa_index_##TYPE##_entry_t *entry; \
elpa_index_##TYPE##_entry_t key = { .base = {.name = name} } ; \
size_t nmembers = nelements(TYPE##_entries); \
entry = lfind((const void*) name, (const void *) TYPE##_entries, &nmembers, sizeof(elpa_index_##TYPE##_entry_t), compar); \
entry = lfind((const void*) &key, (const void *) TYPE##_entries, &nmembers, sizeof(elpa_index_##TYPE##_entry_t), compar); \
if (entry) { \
return (entry - &TYPE##_entries[0]); \
} else { \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment