/* Same as tm_tag_new() except that the tag attributes are read from file. @param mode langType to use for the tag. */ TMTag *tm_tag_new_from_file(TMSourceFile *file, FILE *fp, gint mode, TMFileFormat format) { TMTag *tag; gboolean result = FALSE; TAG_NEW(tag); switch (format) { case TM_FILE_FORMAT_TAGMANAGER: result = tm_tag_init_from_file(tag, file, fp); break; case TM_FILE_FORMAT_PIPE: result = tm_tag_init_from_file_alt(tag, file, fp); break; case TM_FILE_FORMAT_CTAGS: result = tm_tag_init_from_file_ctags(tag, file, fp); break; } if (! result) { TAG_FREE(tag); return NULL; } tag->lang = mode; return tag; }
/* Creates a new tag structure and returns a pointer to it. @return the new TMTag structure. This should be free()-ed using tm_tag_free() */ TMTag *tm_tag_new(void) { TMTag *tag; TAG_NEW(tag); tag->refcount = 1; return tag; }
/* Creates a new tag structure from a tagEntryInfo pointer and a TMSOurceFile pointer and returns a pointer to it. @param file - Pointer to the TMSourceFile structure containing the tag @param tag_entry Contains tag information generated by ctags @return the new TMTag structure. This should be free()-ed using tm_tag_free() */ TMTag *tm_tag_new(TMSourceFile *file, const tagEntryInfo *tag_entry) { TMTag *tag; TAG_NEW(tag); if (FALSE == tm_tag_init(tag, file, tag_entry)) { TAG_FREE(tag); return NULL; } return tag; }
static TMTag *log_tag_new(void) { TMTag *tag; if (! alive_tags) { alive_tags = g_hash_table_new(g_direct_hash, g_direct_equal); atexit(log_refs_at_exit); } TAG_NEW(tag); g_hash_table_insert(alive_tags, tag, tag); return tag; }