示例#1
0
void
u_waitsetEventFree(
    u_waitsetEvent event)
{
    c_long i;

    if (event) {
        switch(event->kind){
            case U_WAITSET_EVENT:
                /*Do nothing*/
                break;
            case U_WAITSET_EVENT_HISTORY_DELETE:
                os_free(u_waitsetHistoryDeleteEvent(event)->partitionExpr);
                os_free(u_waitsetHistoryDeleteEvent(event)->topicExpr);
                break;
            case U_WAITSET_EVENT_HISTORY_REQUEST:
                if(u_waitsetHistoryRequestEvent(event)->filter){
                    os_free(u_waitsetHistoryRequestEvent(event)->filter);
                }
                for(i=0; i<u_waitsetHistoryRequestEvent(event)->filterParamsCount; i++){
                    os_free(u_waitsetHistoryRequestEvent(event)->filterParams[i]);
                }

                if(u_waitsetHistoryRequestEvent(event)->filterParams){
                    os_free(u_waitsetHistoryRequestEvent(event)->filterParams);
                }
                break;
            case U_WAITSET_EVENT_PERSISTENT_SNAPSHOT:
                if(u_waitsetPersistentSnapshotEvent(event)->partitionExpr)
                {
                    os_free(u_waitsetPersistentSnapshotEvent(event)->partitionExpr);
                }
                if(u_waitsetPersistentSnapshotEvent(event)->topicExpr)
                {
                    os_free(u_waitsetPersistentSnapshotEvent(event)->topicExpr);
                }
                if(u_waitsetPersistentSnapshotEvent(event)->uri)
                {
                    os_free(u_waitsetPersistentSnapshotEvent(event)->uri);
                }
                break;
            case U_WAITSET_EVENT_CONNECT_WRITER:
                break;
            default:
                break;
        }
        os_free(event);
    }
}
示例#2
0
u_waitsetEvent
u_waitsetHistoryDeleteEventNew(
    u_entity e,
    c_ulong k,
    const c_char* partitionExpr,
    const c_char* topicExpr,
    c_time deleteTime)
{
    u_waitsetEvent event;

    event = (u_waitsetEvent)os_malloc(C_SIZEOF(u_waitsetHistoryDeleteEvent));

    if (event) {
        event->entity                 = e;
        event->events                 = k;
        event->kind                   = U_WAITSET_EVENT_HISTORY_DELETE;

        u_waitsetHistoryDeleteEvent(event)->partitionExpr          = os_strdup(partitionExpr);
        u_waitsetHistoryDeleteEvent(event)->topicExpr              = os_strdup(topicExpr);
        u_waitsetHistoryDeleteEvent(event)->deleteTime.seconds     = deleteTime.seconds;
        u_waitsetHistoryDeleteEvent(event)->deleteTime.nanoseconds = deleteTime.nanoseconds;
    }
    return event;
}