这篇教程C++ HASH_FIND函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中HASH_FIND函数的典型用法代码示例。如果您正苦于以下问题:C++ HASH_FIND函数的具体用法?C++ HASH_FIND怎么用?C++ HASH_FIND使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了HASH_FIND函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: get_min_time_from_neighboruint32_t get_min_time_from_neighbor(uint8_t neighbor_main_addr[ETH_ALEN]) { if(neighbor_set_ett == NULL) { return false; } // Searching for entry with neighbor_main_addr as key olsr_db_neighbors_ett_entry_t* entry; HASH_FIND(hh, neighbor_set_ett, neighbor_main_addr, ETH_ALEN, entry); if(entry == NULL) { return false; } // searching for the minimum time_int_sw entry uint32_t min = INT_MAX; int i; for(i = 0; i < ETT_SW_SIZE; i++) { if(entry->time_int_sw[i] > 0) { if(entry->time_int_sw[i] < min) { min = entry->time_int_sw[i]; } } } if(min == INT_MAX) { return false; } return min;}
开发者ID:Dekue,项目名称:des-routing-algorithms,代码行数:31,
示例2: process_ett_stop_timeuint32_t process_ett_stop_time(uint8_t neighbor_main_addr[ETH_ALEN], struct timeval* ett_stop_time) { olsr_db_neighbors_ett_entry_t* entry; if(neighbor_set_ett == NULL) { return false; } HASH_FIND(hh, neighbor_set_ett, neighbor_main_addr, ETH_ALEN, entry); if(entry == NULL) { return false; } // If no previous ETT-START package was received false is returned if(entry->timeval_recv.tv_sec == 0 && entry->timeval_recv.tv_usec == 0) { return false; } // calculates the difference between ett_stop_time and timeval_recv struct timeval res; timeval_subtract(&res, &(entry->timeval_recv), ett_stop_time); // calculates the difference time in usec uint32_t result = res.tv_sec * 1000000 + res.tv_usec; // deleting the old timeval_recv value entry->timeval_recv.tv_sec = 0; entry->timeval_recv.tv_usec = 0; return result;}
开发者ID:Dekue,项目名称:des-routing-algorithms,代码行数:28,
示例3: draw_charactervoid draw_character(void *screen,int x,int y,int w,uint32_t cin,uint32_t bg,uint32_t fg,int bold,int underline,int italic,int strike) { SDL_Texture *texture=0; lookup_key_t chr; chr.c = cin; chr.fg = fg; chr.bg = bg; chr.bold = bold; chr.underline = underline; chr.italic = italic; chr.strike = strike; char_render_t *mchr=0; HASH_FIND( hh, display_cache, &chr, char_render_t_keylen, mchr); if(!mchr) { uint32_t Rmask, Gmask, Bmask, Amask; /* masks for desired format */ Rmask = 0xff000000; Gmask = 0x00ff0000; Bmask = 0x0000ff00; Amask = 0x000000ff; int bpp=32; /* bits per pixel for desired format */ // SDL_Surface *converted = SDL_CreateRGBSurface(0,w,16,32,0,0,0,0); SDL_Surface *converted = SDL_CreateRGBSurface(SDL_SWSURFACE, w, 16, bpp, Rmask, Gmask, Bmask, Amask); if(converted == NULL) { printf("failed to create surface/n"); } draw_character_surface(converted,0,0,w,cin,bg,fg,bold,underline,italic,strike); // texture = SDL_CreateTexture(screen,converted->format,0,w,16); // (((uint32_t *) (converted->pixels))[0]) = 0xFFFFFFFF; // SDL_UpdateTexture(texture,NULL,converted->pixels,w*4); texture = SDL_CreateTextureFromSurface(screen, converted); // SDL_Rect dstRect = { x, y, w, 16 }; // SDL_RenderCopy(screen, texture, NULL, &dstRect); // SDL_FreeSurface(converted); mchr = malloc(sizeof(char_render_t)); mchr->c = cin; mchr->fg = fg; mchr->bg = bg; mchr->bold = bold; mchr->underline = underline; mchr->italic = italic; mchr->strike = strike; mchr->texture = texture; HASH_ADD( hh, display_cache, c, char_render_t_keylen, mchr); } SDL_Rect dstRect = { x, y, w, 16 }; SDL_RenderCopy(screen, mchr->texture, NULL, &dstRect);}
开发者ID:new299,项目名称:wflow,代码行数:60,
示例4: get_first_record_numberstruct fl_url_record *get_first_url_record(){ struct fl_url_record *s; uint64_t lowest = get_first_record_number(); HASH_FIND(hh, url_map, &lowest, sizeof(uint64_t), s); return(s);}
开发者ID:sanyaade-g2g-repos,项目名称:fineline-computer-forensics-timeline-tools,代码行数:7,
示例5: fcitx_input_context_manager_create_icFcitxInputContext* fcitx_input_context_manager_create_ic(FcitxInputContextManager* manager, FcitxInputContextFillDataCallback callback, void* userData){ FcitxInputContext* ic = NULL; if (manager->freeList) { ic = manager->freeList; manager->freeList = ic->hh.next; } else { uint32_t newid; while ((newid = ++manager->icid) != 0); HASH_FIND(hh, manager->ics, &newid, sizeof(uint32_t), ic); if (ic) { return NULL; } ic = fcitx_utils_new(FcitxInputContext); ic->id = newid; ic->manager = manager; } if (callback) { callback(ic, userData); } return ic;}
开发者ID:rwdxll,项目名称:fcitx5,代码行数:26,
示例6: update_stat/** * Record or update stat value. */void update_stat( char *group, char *key, char *value ){ DPRINTF("update_stat ( %s, %s, %s )/n", group, key, value); statsd_stat_t *s; statsd_stat_name_t l; memset(&l, 0, sizeof(statsd_stat_name_t)); strcpy(l.group_name, group); strcpy(l.key_name, key); DPRINTF("HASH_FIND '%s' '%s'/n", l.group_name, l.key_name); HASH_FIND( hh, stats, &l, sizeof(statsd_stat_name_t), s ); if (s) { DPRINTF("Updating old stat entry/n"); s->value = atol( value ); } else { DPRINTF("Adding new stat entry/n"); s = malloc(sizeof(statsd_stat_t)); memset(s, 0, sizeof(statsd_stat_t)); strcpy(s->name.group_name, group); strcpy(s->name.key_name, key); s->value = atol(value); s->locked = 0; HASH_ADD( hh, stats, name, sizeof(statsd_stat_name_t), s ); }}
开发者ID:togga,项目名称:statsd-c,代码行数:35,
示例7: _xcb_im_handle_sync_replyvoid _xcb_im_handle_sync_reply(xcb_im_t* im, xcb_im_client_t* client, const xcb_im_packet_header_fr_t* hdr, uint8_t* data){ xcb_im_sync_reply_fr_t frame; _xcb_im_read_frame_with_error(im, client, frame, data, XIM_MESSAGE_BYTES(hdr)); do { if (client->connect_id != frame.input_method_ID) { break; } xcb_im_input_context_t* ic = NULL; HASH_FIND(hh, client->input_contexts, &frame.input_context_ID, sizeof(uint16_t), ic); if (!ic) { break; } client->sync = false; if (im->sync) { im->sync = false; if (im->callback) { im->callback(im, client, ic, hdr, &frame, NULL, im->user_data); } } _xcb_im_process_queue(im, client); } while(0); xcb_im_sync_reply_fr_free(&frame);}
开发者ID:wengxt,项目名称:xcb-imdkit,代码行数:30,
示例8: __AI_heuristic_funcPRIVATE int__AI_heuristic_func ( cluster_type type ){ AI_snort_alert *alert_iterator; attribute_key key; attribute_value *values = NULL; attribute_value *value = NULL; attribute_value *found = NULL; int max = 0; if ( type == none || !alert_log || !h_root[type] ) return -1; for ( alert_iterator = alert_log; alert_iterator; alert_iterator = alert_iterator->next ) { if ( !alert_iterator->h_node[type] ) continue; key.min = alert_iterator->h_node[type]->min_val; key.max = alert_iterator->h_node[type]->max_val; if ( values ) { HASH_FIND ( hh, values, &key, sizeof ( attribute_key ), found ); } if ( !found ) { if ( !( value = ( attribute_value* ) malloc ( sizeof ( attribute_value )) )) { AI_fatal_err ( "Fatal dynamic memory allocation failure", __FILE__, __LINE__ ); } memset ( value, 0, sizeof ( attribute_value )); value->key = key; value->type = type; value->count = 1; HASH_ADD ( hh, values, key, sizeof ( attribute_key ), value ); } else { found->count++; } } for ( value = values; value; value = ( attribute_value* ) value->hh.next ) { if ( value->count > max ) { max = value->count; } } while ( values ) { value = values; HASH_DEL ( values, value ); free ( value ); } return max;} /* ----- end of function __AI_heuristic_func ----- */
开发者ID:BlackLight,项目名称:Snort_AIPreproc,代码行数:60,
示例9: update_stat/** * Record or update stat value. */void update_stat( char *group, char *key, char *value ) { syslog(LOG_DEBUG, "update_stat ( %s, %s, %s )/n", group, key, value); statsd_stat_t *s; statsd_stat_name_t l; memset(&l, 0, sizeof(statsd_stat_name_t)); strcpy(l.group_name, group); strcpy(l.key_name, key); syslog(LOG_DEBUG, "HASH_FIND '%s' '%s'/n", l.group_name, l.key_name); HASH_FIND( hh, stats, &l, sizeof(statsd_stat_name_t), s ); if (s) { syslog(LOG_DEBUG, "Updating old stat entry"); wait_for_stats_lock(); s->value = atol( value ); remove_stats_lock(); } else { syslog(LOG_DEBUG, "Adding new stat entry"); s = malloc(sizeof(statsd_stat_t)); memset(s, 0, sizeof(statsd_stat_t)); strcpy(s->name.group_name, group); strcpy(s->name.key_name, key); s->value = atol(value); s->locked = 0; wait_for_stats_lock(); HASH_ADD( hh, stats, name, sizeof(statsd_stat_name_t), s ); remove_stats_lock(); }}
开发者ID:ak2consulting,项目名称:statsd-c-buildpackage,代码行数:35,
示例10: olsr_db_brct_addidint olsr_db_brct_addid(uint8_t shost_ether[ETH_ALEN], uint32_t brc_id, struct timeval* purge_time) { olsr_brclog_entry_t* entry; timeslot_purgeobjects(brclog_ts); HASH_FIND(hh, brclog_set, shost_ether, ETH_ALEN, entry); if(entry == NULL) { entry = malloc(sizeof(olsr_brclog_entry_t)); if(entry == NULL) { return false; } memcpy(entry->shost_ether, shost_ether, ETH_ALEN); HASH_ADD_KEYPTR(hh, brclog_set, entry->shost_ether, ETH_ALEN, entry); entry->brc_id = brc_id; timeslot_addobject(brclog_ts, purge_time, entry); return true; } if(entry->brc_id < brc_id) { entry->brc_id = brc_id; timeslot_addobject(brclog_ts, purge_time, entry); return true; } return false;}
开发者ID:Dekue,项目名称:des-routing-algorithms,代码行数:27,
示例11: mgr_on_acceptvoid mgr_on_accept(int fd, event_manager* ev_mgr){ if (internal_threads(ev_mgr->excluded_threads, pthread_self())) return; uint32_t leader_id = get_leader_id(ev_mgr->con_node); if (ev_mgr->node_id == leader_id) { leader_tcp_pair* new_conn = malloc(sizeof(leader_tcp_pair)); memset(new_conn,0,sizeof(leader_tcp_pair)); new_conn->key = fd; HASH_ADD_INT(ev_mgr->leader_tcp_map, key, new_conn); rsm_op(ev_mgr->con_node, 0, NULL, P_TCP_CONNECT, &new_conn->vs); } else { request_record* retrieve_data = NULL; size_t data_size; while (retrieve_data == NULL){ retrieve_record(ev_mgr->db_ptr, sizeof(db_key_type), &ev_mgr->cur_rec, &data_size, (void**)&retrieve_data); } replica_tcp_pair* ret = NULL; HASH_FIND(hh, ev_mgr->replica_tcp_map, &retrieve_data->clt_id, sizeof(view_stamp), ret); ret->s_p = fd; ret->accepted = 1; } return;}
开发者ID:apsys16-p10,项目名称:falcon,代码行数:30,
示例12: PinyinEnhanceMapAddvoidPinyinEnhanceMapAdd(PyEnhanceMap **map, FcitxMemoryPool *pool, const char *key, unsigned int key_l, const char *word, unsigned int word_l){ PyEnhanceMapWord *py_word; PyEnhanceMap *py_map;#define uthash_malloc(sz) fcitx_memory_pool_alloc_align(pool, sz)#define uthash_free(ptr) word_l++; py_word = uthash_malloc(sizeof(PyEnhanceMapWord) + word_l); memcpy(py_enhance_map_word(py_word), word, word_l); HASH_FIND(hh, *map, key, key_l, py_map); if (py_map) { py_word->next = py_map->words; py_map->words = py_word; } else { py_map = uthash_malloc(sizeof(PyEnhanceMap) + key_l + 1); py_map->words = py_word; py_word->next = NULL; memcpy(py_enhance_map_key(py_map), key, key_l + 1); HASH_ADD_KEYPTR(hh, *map, py_enhance_map_key(py_map), key_l, py_map); }#undef uthash_malloc#undef uthash_free}
开发者ID:13572293130,项目名称:fcitx,代码行数:26,
示例13: parse_packetint parse_packet(struct sockaddr_in* addr, char* raw, struct packet_header* header, char* body) { struct io_peer *peer = NULL; HASH_FIND(hh_addr, peers_addr, addr, sizeof(struct sockaddr_in), peer); if (peer == NULL) { DPRINTF(DEBUG_SOCKETS, "Unknown peer from %s:%d/n", inet_ntoa(addr->sin_addr), ntohs(addr->sin_port)); return -1; } int peer_id = peer->id; memcpy(header, raw, sizeof(struct packet_header)); packet_ntoh(header); if (header->magic != PACKET_MAGIC || header->version != PACKET_VERSION) { fprintf(stderr, "Cannot parse unknown packet with MAGIC %d and version %d/n", header->magic, header->version); return -1; } if (header->type == PACKET_ACK) { ++header->ack; } size_t body_len = header->total_len - header->header_len; memcpy(body, raw + header->header_len, body_len); DPRINTF(DEBUG_SOCKETS, "receive packet from peer:%d type:%d seq:%d ack:%d body_len:%d/n", peer_id, header->type, header->seq, header->ack, body_len); return peer_id;}
开发者ID:htc550605125,项目名称:p2p-network,代码行数:30,
示例14: _xcb_im_handle_reset_icvoid _xcb_im_handle_reset_ic(xcb_im_t* im, xcb_im_client_t* client, const xcb_im_packet_header_fr_t* hdr, uint8_t* data){ xcb_im_reset_ic_fr_t frame; _xcb_im_read_frame_with_error(im, client, frame, data, XIM_MESSAGE_BYTES(hdr)); do { if (client->connect_id != frame.input_method_ID) { break; } xcb_im_input_context_t* ic = NULL; HASH_FIND(hh, client->input_contexts, &frame.input_context_ID, sizeof(uint16_t), ic); if (!ic) { break; } xcb_im_reset_ic_reply_fr_t reply_frame; reply_frame.input_method_ID = frame.input_method_ID; reply_frame.input_context_ID = frame.input_context_ID; reply_frame.committed_string = NULL; reply_frame.byte_length_of_committed_string = 0; if (im->callback) { im->callback(im, client, ic, hdr, &frame, &reply_frame, im->user_data); } _xcb_im_send_frame(im, client, reply_frame, true); free(reply_frame.committed_string); } while(0); xcb_im_reset_ic_fr_free(&frame);}
开发者ID:wengxt,项目名称:xcb-imdkit,代码行数:32,
示例15: _xcb_im_handle_forward_eventvoid _xcb_im_handle_forward_event(xcb_im_t* im, xcb_im_client_t* client, const xcb_im_packet_header_fr_t* hdr, uint8_t* data){ xcb_im_forward_event_fr_t frame; _xcb_im_read_frame_with_error(im, client, frame, data, XIM_MESSAGE_BYTES(hdr)); do { if (client->connect_id != frame.input_method_ID) { break; } if (XIM_MESSAGE_BYTES(hdr) < xcb_im_forward_event_fr_size(&frame) + sizeof(xcb_key_press_event_t)) { break; } xcb_im_input_context_t* ic = NULL; HASH_FIND(hh, client->input_contexts, &frame.input_context_ID, sizeof(uint16_t), ic); if (!ic) { break; } if (client->sync) { _xcb_im_add_queue(im, client, ic->id, hdr, &frame, data); } else { xcb_key_press_event_t key_event; memcpy(&key_event, data, sizeof(xcb_key_press_event_t)); if (im->callback) { im->callback(im, client, ic, hdr, &frame, &key_event, im->user_data); } } } while(0); xcb_im_forward_event_fr_free(&frame);}
开发者ID:wengxt,项目名称:xcb-imdkit,代码行数:33,
示例16: nat_fix_upstreamint nat_fix_upstream(nat_ctx_t *ctx, unsigned char *buf, size_t buflen, const struct sockaddr *addr, socklen_t addrlen) { uint8_t iphdr_len; if (buflen < SHADOWVPN_USERTOKEN_LEN + 20) { errf("nat: ip packet too short"); return -1; } ipv4_hdr_t *iphdr = (ipv4_hdr_t *)(buf + SHADOWVPN_USERTOKEN_LEN); if ((iphdr->ver & 0xf0) != 0x40) { // check header, currently IPv4 only // bypass IPv6 return 0; } iphdr_len = (iphdr->ver & 0x0f) * 4; // print_hex_memory(buf, SHADOWVPN_USERTOKEN_LEN); client_info_t *client = NULL; HASH_FIND(hh1, ctx->token_to_clients, buf, SHADOWVPN_USERTOKEN_LEN, client); if (client == NULL) { errf("nat: client not found for given user token"); return -1; } // print_hex_memory(iphdr, buflen - SHADOWVPN_USERTOKEN_LEN); // save source address client->source_addr.addrlen = addrlen; memcpy(&client->source_addr.addr, addr, addrlen); int32_t acc = 0; // save tun input ip to client client->input_tun_ip = iphdr->saddr; // overwrite IP iphdr->saddr = client->output_tun_ip; // add old, sub new acc = client->input_tun_ip - iphdr->saddr; ADJUST_CHECKSUM(acc, iphdr->checksum); if (0 == (iphdr->frag & htons(0x1fff))) { // only adjust tcp & udp when frag offset == 0 void *ip_payload = buf + SHADOWVPN_USERTOKEN_LEN + iphdr_len; if (iphdr->proto == IPPROTO_TCP) { if (buflen < iphdr_len + 20) { errf("nat: tcp packet too short"); return -1; } tcp_hdr_t *tcphdr = ip_payload; ADJUST_CHECKSUM(acc, tcphdr->checksum); } else if (iphdr->proto == IPPROTO_UDP) { if (buflen < iphdr_len + 8) { errf("nat: udp packet too short"); return -1; } udp_hdr_t *udphdr = ip_payload; ADJUST_CHECKSUM(acc, udphdr->checksum); } } return 0;}
开发者ID:00o0o,项目名称:ShadowVPN,代码行数:60,
示例17: _xcb_im_handle_destroy_icvoid _xcb_im_handle_destroy_ic(xcb_im_t* im, xcb_im_client_t* client, const xcb_im_packet_header_fr_t* hdr, uint8_t* data){ xcb_im_destroy_ic_fr_t frame; _xcb_im_read_frame_with_error(im, client, frame, data, XIM_MESSAGE_BYTES(hdr)); do { if (frame.input_method_ID != client->connect_id) { break; } xcb_im_input_context_t* ic = NULL; HASH_FIND(hh, client->input_contexts, &frame.input_context_ID, sizeof(uint16_t), ic); if (!ic) { break; } xcb_im_destroy_ic_reply_fr_t reply_frame; reply_frame.input_method_ID = client->connect_id; reply_frame.input_context_ID = frame.input_context_ID; xcb_im_destroy_ic_fr_free(&frame); _xcb_im_destroy_ic(im, ic); _xcb_im_send_frame(im, client, reply_frame, true); return; } while(0); // error xcb_im_destroy_ic_fr_free(&frame); _xcb_im_send_error_message(im, client); return;}
开发者ID:wengxt,项目名称:xcb-imdkit,代码行数:34,
示例18: moloch_plugins_register_internalint moloch_plugins_register_internal(const char * name, gboolean storeData, size_t sessionsize, int apiversion){ MolochPlugin_t *plugin; if (sizeof(MolochSession_t) != sessionsize) { LOG("Plugin '%s' built with different version of moloch.h", name); exit(-1); } if (MOLOCH_API_VERSION != apiversion) { LOG("Plugin '%s' built with different version of moloch.h", name); exit(-1); } HASH_FIND(p_, plugins, name, plugin); if (plugin) { LOG("Plugin %s is already registered", name); exit(-1); } plugin = MOLOCH_TYPE_ALLOC0(MolochPlugin_t); plugin->name = strdup(name); if (storeData) { plugin->num = config.numPlugins++; } else { plugin->num = -1; } HASH_ADD(p_, plugins, name, plugin); return plugin->num;}
开发者ID:Amelos,项目名称:moloch,代码行数:33,
示例19: dist_bag_compare/** * Computes the bag distance of two strings. The distance approximates * and lower bounds the Levenshtein distance. * @param x first string * @param y second string * @return Bag distance */float dist_bag_compare(hstring_t x, hstring_t y){ float d = 0; bag_t *xh, *yh, *xb, *yb; xh = bag_create(x); yh = bag_create(y); int missing = y.len; for (xb = xh; xb != NULL; xb = xb->hh.next) { HASH_FIND(hh, yh, &(xb->sym), sizeof(sym_t), yb); if (!yb) { d += xb->cnt; } else { d += fabs(xb->cnt - yb->cnt); missing -= yb->cnt; } } d += missing; bag_destroy(xh); bag_destroy(yh); return lnorm(n, d, x, y);}
开发者ID:MLDroid,项目名称:harry,代码行数:32,
示例20: do_action_tcp_connectstatic void do_action_tcp_connect(view_stamp clt_id,void* arg){ event_manager* ev_mgr = arg; replica_tcp_pair* ret; HASH_FIND(hh, ev_mgr->replica_tcp_map, &clt_id, sizeof(view_stamp), ret); if(NULL==ret){ ret = malloc(sizeof(replica_tcp_pair)); memset(ret,0,sizeof(replica_tcp_pair)); ret->key = clt_id; ret->accepted = 0; HASH_ADD(hh, ev_mgr->replica_tcp_map, key, sizeof(view_stamp), ret); } int fd = socket(AF_INET, SOCK_STREAM, 0); connect(fd, (struct sockaddr*)&ev_mgr->sys_addr.s_addr,ev_mgr->sys_addr.s_sock_len); ret->p_s = fd; SYS_LOG(ev_mgr, "EVENT MANAGER sets up socket connection with server application./n"); set_blocking(fd, 0); int enable = 1; if(setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (void*)&enable, sizeof(enable)) < 0) printf("TCP_NODELAY SETTING ERROR!/n"); keep_alive(fd); while (!ret->accepted); return;}
开发者ID:apsys16-p10,项目名称:falcon,代码行数:30,
示例21: IRType_IsSubclassOfbool_t IRType_IsSubclassOf(IRType* pType, IRType* pParentType){ if (pType == pParentType) return TRUE; if (pParentType->IsInterface) { IRInterfaceImpl* lookupType = NULL; HASH_FIND(HashHandle, pType->InterfaceTable, pParentType, sizeof(void*), lookupType); if (lookupType) return TRUE; } if (pType->TypeDefinition->Extends.TypeDefinition == NULL) return FALSE; switch(pType->TypeDefinition->TypeOfExtends) { case TypeDefRefOrSpecType_TypeDefinition: return IRType_IsSubclassOf(pType->TypeDefinition->Extends.TypeDefinition->File->Assembly->Types[pType->TypeDefinition->Extends.TypeDefinition->TableIndex - 1], pParentType); break; case TypeDefRefOrSpecType_TypeReference: return IRType_IsSubclassOf(pType->TypeDefinition->Extends.TypeReference->ResolvedType->File->Assembly->Types[pType->TypeDefinition->Extends.TypeReference->ResolvedType->TableIndex - 1], pParentType); break; case TypeDefRefOrSpecType_TypeSpecification: Panic("This isn't supported yet, cannot determine the inheritence chain of a generic class yet."); break; } Panic("Invalid TypeOfExtends!");}
开发者ID:Orvid,项目名称:Proton,代码行数:25,
示例22: hash_addvoid hash_add(int key, long payload, int *id_ctr){ record_t *s; HASH_FIND(hh, records, &key, sizeof(int),s); //When true, no record with same key exists if(s==NULL) { record_t *r = (record_t*)malloc( sizeof(record_t) ); memset(r, 0, sizeof(record_t)); r->key=key; r->payload=payload; r->id=(*id_ctr)++; r->count=1; HASH_ADD(hh, records, key, sizeof(int), r); ll_add(r->id); } else { //record with same key exists. need to find out if it's the same payload if (s->payload == payload) { s->count++; ll_add(s->id); } else { //key collision for different payloads...what to do? //kinda want to linear probe. maybe chaining } }}
开发者ID:tommy-u,项目名称:state_diffs,代码行数:33,
示例23: HASH_FINDstruct fl_url_record *find_url(uint64_t url_id) { struct fl_url_record *s; HASH_FIND(hh, url_map, &url_id, sizeof(url_id), s); /* s: output pointer */ return s;}
开发者ID:sanyaade-g2g-repos,项目名称:fineline-computer-forensics-timeline-tools,代码行数:7,
示例24: _xcb_im_handle_ext_forward_keyeventvoid _xcb_im_handle_ext_forward_keyevent(xcb_im_t* im, xcb_im_client_t* client, const xcb_im_packet_header_fr_t* hdr, uint8_t* data){ xcb_im_ext_forward_keyevent_fr_t frame; _xcb_im_read_frame_with_error(im, client, frame, data, XIM_MESSAGE_BYTES(hdr)); do { if (client->connect_id != frame.input_method_ID) { break; } xcb_im_input_context_t* ic = NULL; HASH_FIND(hh, client->input_contexts, &frame.input_context_ID, sizeof(uint16_t), ic); if (!ic) { break; } xcb_key_press_event_t key_event; memset(&key_event, 0, sizeof(key_event)); key_event.response_type = frame.xEvent_u_u_type; key_event.sequence = frame.sequence_number; key_event.root = im->default_screen->root; key_event.time = frame.time; key_event.detail = frame.keycode; key_event.state = frame.state; key_event.event = frame.window; if (im->callback) { im->callback(im, client, ic, hdr, &frame, &key_event, im->user_data); } } while(0); xcb_im_ext_forward_keyevent_fr_free(&frame);}
开发者ID:wengxt,项目名称:xcb-imdkit,代码行数:33,
示例25: check_symloop_enterstatic int check_symloop_enter(const char *path, dirkey_t *outkey) {#ifdef _WIN32 return SYMLOOP_OK;#else struct stat buf; symdir_t *item_found = NULL; symdir_t *new_item = NULL; memset(outkey, 0, sizeof(dirkey_t)); outkey->dev = 0; outkey->ino = 0; int res = stat(path, &buf); if (res != 0) { log_err("Error stat()ing: %s", path); return SYMLOOP_ERROR; } outkey->dev = buf.st_dev; outkey->ino = buf.st_ino; HASH_FIND(hh, symhash, outkey, sizeof(dirkey_t), item_found); if (item_found) { return SYMLOOP_LOOP; } new_item = (symdir_t*)malloc(sizeof(symdir_t)); memcpy(&new_item->key, outkey, sizeof(dirkey_t)); HASH_ADD(hh, symhash, key, sizeof(dirkey_t), new_item); return SYMLOOP_OK;#endif}
开发者ID:CarlQLange,项目名称:the_silver_searcher,代码行数:32,
示例26: moloch_field_by_expint moloch_field_by_exp(char *exp){ MolochFieldInfo_t *info = 0; HASH_FIND(e_, fieldsByExp, exp, info); if (info) return info->pos; return -1;}
开发者ID:kakakacool,项目名称:moloch,代码行数:8,
示例27: moloch_field_by_dbint moloch_field_by_db(char *dbField){ MolochFieldInfo_t *info = 0; HASH_FIND(d_, fieldsByDb, dbField, info); if (info) return info->pos; return -1;}
开发者ID:kakakacool,项目名称:moloch,代码行数:8,
示例28: fcitx_input_context_manager_focus_invoid fcitx_input_context_manager_focus_in(FcitxInputContextManager* manager, uint32_t id){ FcitxInputContext* ic = NULL; HASH_FIND(hh, manager->ics, &id, sizeof(uint32_t), ic); if (ic) { manager->currentIC = ic; }}
开发者ID:rwdxll,项目名称:fcitx5,代码行数:8,
示例29: HASH_FIND/* Retrieve a pointer to the window structure for specified id */window_t *window_get(Window id){ window_t *window; HASH_FIND(hh, window_map, &id, sizeof(Window), window); return window;}
开发者ID:nowylie,项目名称:space,代码行数:9,
注:本文中的HASH_FIND函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ HASH_FIND_INT函数代码示例 C++ HASH_DataIn函数代码示例 |