コード例 #1
0
ファイル: report_op.c プロジェクト: DaneTheory/ossec-hids
/* Add the entry to the hash. */
int _os_report_add_tostore(char *key, OSStore *top, void *data)
{
    OSList *top_list;

    /* Adding data to the hash. */
    top_list = OSStore_Get(top, key);
    if(top_list)
    {
        OSList_AddData(top_list, data);
    }
    else
    {
        top_list = OSList_Create();
        if(!top_list)
        {
            merror(MEM_ERROR, __local_name);
            return(0);
        }
        OSList_AddData(top_list, data);

        OSStore_Put(top, key, top_list);
    }

    return(1);
}
コード例 #2
0
/* Add the entry to the hash */
static int _os_report_add_tostore(const char *key, OSStore *top, void *data)
{
    OSList *top_list;

    /* Add data to the hash */
    top_list = (OSList *) OSStore_Get(top, key);
    if (top_list) {
        OSList_AddData(top_list, data);
    } else {
        top_list = OSList_Create();
        if (!top_list) {
            merror(MEM_ERROR, __local_name, errno, strerror(errno));
            return (0);
        }
        OSList_AddData(top_list, data);

        OSStore_Put(top, key, top_list);
    }

    return (1);
}