NULL logic



  • I'm cleaning up some code in Tracker, and while most of the code is reasonable enough, there's some superstition about NULL:

    -------------

    description = get_file_type_description (uri, mime, vfs_file_info);
    if (!description) {
        description = g_strdup (mime);
    }
    [...]
    COLUMN_MIME, (description != NULL) ? description : mime,

    -------------

    if (gsearch->search_term) {
        search_term = gsearch->search_term;
    } else {
        search_term = NULL;
    }

    -------------



  • Well, unfounded paranoia, yes, but not entirely harmful yet... at least it doesn't have g_string_equal(user_status,PLANT) || g_string_equal(user_status,BOT); or jam_it(GEE_HAW); all over the place...


Log in to reply