FreeBSD/contrib/mdocml/tag.c
/*
 * Set the line number where a term is defined,
 * unless it is already defined at a higher priority.
 */
Set the line number where a term is defined,
unless it is already defined at a higher priority.
Set the line number where a term is defined unless it is already defined at a higher priority .
void
tag_put(const char *s, int prio, size_t line)
{
	struct tag_entry	*entry;
	size_t			 len;
	unsigned int		 slot;
	if (tag_files.tfd <= 0 || strchr(s, ' ') != NULL)
		return;
	slot = ohash_qlookup(&tag_data, s);
	entry = ohash_find(&tag_data, slot);
	if (entry == NULL) {
		len = strlen(s) + 1;
		entry = mandoc_malloc(sizeof(*entry) + len);
		memcpy(entry->s, s, len);
		ohash_insert(&tag_data, slot, entry);
	} else if (entry->prio <= prio)
		return;
	entry->line = line;
	entry->prio = prio;
}
void tag_put ( const char * s , int prio , size_t line ) { struct tag_entry * entry ; size_t len ; unsigned int slot ; if ( tag_files . tfd <= 0 || strchr ( s , ' ' ) != NULL ) return ; slot = ohash_qlookup ( & tag_data , s ) ; entry = ohash_find ( & tag_data , slot ) ; if ( entry == NULL ) { len = strlen ( s ) + 1 ; entry = mandoc_malloc ( sizeof ( * entry ) + len ) ; memcpy ( entry -> s , s , len ) ; ohash_insert ( & tag_data , slot , entry ) ; } else if ( entry -> prio <= prio ) return ; entry -> line = line ; entry -> prio = prio ; }
Set the line number where a term is defined,
 unless it is already defined at a higher priority.
Set the line number where a term is defined unless it is already defined at a higher priority .