link * temp_link;
// Add link via `clean_text`?
- HASH_FIND_STR(scratch->link_hash, l->clean_text, temp_link);
-
- if (!temp_link) {
- // Only add if another link is not found with clean_text
- temp_link = link_shallow_copy(l);
- HASH_ADD_KEYPTR(hh, scratch->link_hash, l->clean_text, strlen(l->clean_text), temp_link);
+ if (l->clean_text && l->clean_text[0] != '\0') {
+ HASH_FIND_STR(scratch->link_hash, l->clean_text, temp_link);
+
+ if (!temp_link) {
+ // Only add if another link is not found with clean_text
+ temp_link = link_shallow_copy(l);
+ HASH_ADD_KEYPTR(hh, scratch->link_hash, l->clean_text, strlen(l->clean_text), temp_link);
+ }
}
// Add link via `label_text`?
- HASH_FIND_STR(scratch->link_hash, l->label_text, temp_link);
+ if (l->label_text && l->label_text[0] != '\0') {
+ HASH_FIND_STR(scratch->link_hash, l->label_text, temp_link);
- if (!temp_link) {
- // Only add if another link is not found with label_text
- temp_link = link_shallow_copy(l);
- HASH_ADD_KEYPTR(hh, scratch->link_hash, l->label_text, strlen(l->label_text), temp_link);
+ if (!temp_link) {
+ // Only add if another link is not found with label_text
+ temp_link = link_shallow_copy(l);
+ HASH_ADD_KEYPTR(hh, scratch->link_hash, l->label_text, strlen(l->label_text), temp_link);
+ }
}
}
fn_holder * temp_holder;
// Store by `clean_text`?
- HASH_FIND_STR(scratch->footnote_hash, f->clean_text, temp_holder);
+ if (f->clean_text && f->clean_text[0] != '\0') {
+ HASH_FIND_STR(scratch->footnote_hash, f->clean_text, temp_holder);
- if (!temp_holder) {
- temp_holder = fn_holder_new(f);
- HASH_ADD_KEYPTR(hh, scratch->footnote_hash, f->clean_text, strlen(f->clean_text), temp_holder);
+ if (!temp_holder) {
+ temp_holder = fn_holder_new(f);
+ HASH_ADD_KEYPTR(hh, scratch->footnote_hash, f->clean_text, strlen(f->clean_text), temp_holder);
+ }
}
// Store by `label_text`?
- HASH_FIND_STR(scratch->footnote_hash, f->label_text, temp_holder);
+ if (f->label_text && f->label_text[0] != '\0') {
+ HASH_FIND_STR(scratch->footnote_hash, f->label_text, temp_holder);
- if (!temp_holder) {
- temp_holder = fn_holder_new(f);
- HASH_ADD_KEYPTR(hh, scratch->footnote_hash, f->label_text, strlen(f->label_text), temp_holder);
+ if (!temp_holder) {
+ temp_holder = fn_holder_new(f);
+ HASH_ADD_KEYPTR(hh, scratch->footnote_hash, f->label_text, strlen(f->label_text), temp_holder);
+ }
}
}
fn_holder * temp_holder;
// Store by `clean_text`?
- HASH_FIND_STR(scratch->citation_hash, f->clean_text, temp_holder);
+ if (f->clean_text && f->clean_text[0] != '\0') {
+ HASH_FIND_STR(scratch->citation_hash, f->clean_text, temp_holder);
- if (!temp_holder) {
- temp_holder = fn_holder_new(f);
- HASH_ADD_KEYPTR(hh, scratch->citation_hash, f->clean_text, strlen(f->clean_text), temp_holder);
+ if (!temp_holder) {
+ temp_holder = fn_holder_new(f);
+ HASH_ADD_KEYPTR(hh, scratch->citation_hash, f->clean_text, strlen(f->clean_text), temp_holder);
+ }
}
// Store by `label_text`?
- HASH_FIND_STR(scratch->citation_hash, f->label_text, temp_holder);
+ if (f->label_text && f->label_text[0] != '\0') {
+ HASH_FIND_STR(scratch->citation_hash, f->label_text, temp_holder);
- if (!temp_holder) {
- temp_holder = fn_holder_new(f);
- HASH_ADD_KEYPTR(hh, scratch->citation_hash, f->label_text, strlen(f->label_text), temp_holder);
+ if (!temp_holder) {
+ temp_holder = fn_holder_new(f);
+ HASH_ADD_KEYPTR(hh, scratch->citation_hash, f->label_text, strlen(f->label_text), temp_holder);
+ }
}
}
fn_holder * temp_holder;
// Store by `clean_text`?
- HASH_FIND_STR(scratch->glossary_hash, f->clean_text, temp_holder);
+ if (f->clean_text && f->clean_text[0] != '\0') {
+ HASH_FIND_STR(scratch->glossary_hash, f->clean_text, temp_holder);
- if (!temp_holder) {
- temp_holder = fn_holder_new(f);
- HASH_ADD_KEYPTR(hh, scratch->glossary_hash, f->clean_text, strlen(f->clean_text), temp_holder);
+ if (!temp_holder) {
+ temp_holder = fn_holder_new(f);
+ HASH_ADD_KEYPTR(hh, scratch->glossary_hash, f->clean_text, strlen(f->clean_text), temp_holder);
+ }
}
// Store by `label_text`?
- HASH_FIND_STR(scratch->glossary_hash, f->label_text, temp_holder);
+ if (f->label_text && f->label_text[0] != '\0') {
+ HASH_FIND_STR(scratch->glossary_hash, f->label_text, temp_holder);
- if (!temp_holder) {
- temp_holder = fn_holder_new(f);
- HASH_ADD_KEYPTR(hh, scratch->glossary_hash, f->label_text, strlen(f->label_text), temp_holder);
+ if (!temp_holder) {
+ temp_holder = fn_holder_new(f);
+ HASH_ADD_KEYPTR(hh, scratch->glossary_hash, f->label_text, strlen(f->label_text), temp_holder);
+ }
}
}
meta * temp;
// Store by `key`
- HASH_FIND_STR(scratch->meta_hash, m->key, temp);
+ if (m->key && m->key[0] != '\0') {
+ HASH_FIND_STR(scratch->meta_hash, m->key, temp);
- if (!temp) {
- HASH_ADD_KEYPTR(hh, scratch->meta_hash, m->key, strlen(m->key), m);
+ if (!temp) {
+ HASH_ADD_KEYPTR(hh, scratch->meta_hash, m->key, strlen(m->key), m);
+ }
}
}
fn_holder * temp_holder;
// Store by `label_text`
- HASH_FIND_STR(scratch->abbreviation_hash, f->label_text, temp_holder);
+ if (f->label_text && f->label_text[0] != '\0') {
+ HASH_FIND_STR(scratch->abbreviation_hash, f->label_text, temp_holder);
- if (!temp_holder) {
- temp_holder = fn_holder_new(f);
- HASH_ADD_KEYPTR(hh, scratch->abbreviation_hash, f->label_text, strlen(f->label_text), temp_holder);
+ if (!temp_holder) {
+ temp_holder = fn_holder_new(f);
+ HASH_ADD_KEYPTR(hh, scratch->abbreviation_hash, f->label_text, strlen(f->label_text), temp_holder);
+ }
}
}