On Wed, 12 Mar 2008 22:52:39 +0200 Yura Siamashka yurand2@gmail.com wrote:
On Wed, 12 Mar 2008 14:13:55 +0000 Nick Treleaven nick.treleaven@btinternet.com wrote:
GEANY_FILETYPES_ALL is always one before GEANY_MAX_FILE_TYPES. This is the best you can do for now. I guess because of this we need to always increment the ABI when adding filetypes. (I'm planning on making the filetypes array dynamic in future, so then it would be something like filetypes->len.)
No need. I can calculate filetypes length checking if current
There are other reasons why it needs to be dynamic, just thought I'd mention it.
filetype is last (check it's uid with FILETYPE_UID_ALL).
I guess that is pretty robust way of checking it - although we will increment the plugin ABI if we add any filetypes, as other plugins might rely on GEANY_MAX_FILE_TYPES as well.
What about allocating filetypes as [GEANY_MAX_FILE_TYPES + 1]? Extra NULL pointer will tell array size for sure and there are glib functions for working with such data.
If there's going to be a change, it should be to make filetypes a dynamic array (necessary for loading custom filetypes). But if you want you could write a filetypes_foreach() function for the plugin API, that might be useful.
BTW which GLib functions do you mean?
Regards, Nick