static int dequeueCommand (Queue *queue) { CommandQueueItem *item; while ((item = dequeueItem(queue))) { int command = item->command; free(item); #ifdef ENABLE_API if (apiStarted) { if ((command = api_handleCommand(command)) == EOF) { continue; } } #endif /* ENABLE_API */ return command; } return EOF; }
static int apiHandleCommand (int command) { if (!apiStarted) return 0; return api_handleCommand(command); }