rem: g_hash_table_remove(reqtab, (gpointer) id);
add: g_hash_table_remove(reqtab, GUINT_TO_POINTER(id));
context: static void *process_requests(void *data_){    int res;    (void) data_;    while (1) {        struct buffer buf;        uint8_t type;        struct request *req;        uint32_t id;        buf_init(&buf, 0);        res = sftp_read(&type, &buf);        if (res == -1)            break;        if (buf_get_uint32(&buf, &id) == -1)            break;        pthread_mutex_lock(&lock);        req = (struct request *) g_hash_table_lookup(reqtab, (gpointer) id);        if (req == NULL)            fprintf(stderr, "request %i not found\n", id);        else            g_hash_table_remove(reqtab, (gpointer) id);        pthread_mutex_unlock(&lock);        if (req != NULL) {            struct timeval now;            unsigned int difftime;            gettimeofday(&now, NULL);            difftime = (now.tv_sec - req->start.tv_sec) * 1000;            difftime += (now.tv_usec - req->start.tv_usec) / 1000;            DEBUG("  [%05i] %14s %8ibytes (%ims)\n", id, type_name(type),                  buf.size+5, difftime);            req->reply = buf;            req->reply_type = type;            req->replied = 1;            if (req->want_reply)                sem_post(&req->ready);            else {                if (req->end_func) {                    pthread_mutex_lock(&lock);                    req->end_func(req);                    pthread_mutex_unlock(&lock);                }                request_free(req);            }        } else            buf_free(&buf);    }    if (!reconnect) {        /* harakiri */        kill(getpid(), SIGTERM);    } else {        pthread_mutex_lock(&lock);        processing_thread_started = 0;        close(infd);        infd = -1;        close(outfd);        outfd = -1;        g_hash_table_foreach_remove(reqtab, (GHRFunc) clean_req, NULL);        connver ++;        pthread_mutex_unlock(&lock);    }    return NULL;}