fix crash on empty resource (spotted and original patch by Stephen Paul Weber)
replace deprecated g_strncasecmp with g_ascii_strncasecmp
kill useless macro