functionSource
stringlengths
20
97.4k
CWE-119
bool
2 classes
CWE-120
bool
2 classes
CWE-469
bool
2 classes
CWE-476
bool
2 classes
CWE-other
bool
2 classes
combine
int64
0
1
position_process_route(const route_head * rh) { int i = rh->rte_waypt_ct; if (i) { cur_rte = (route_head *)rh; position_runqueue((queue *)&rh->waypoint_list, i, rtedata); cur_rte = NULL; } }
false
false
false
false
false
0
hexUid() { QString strHexUid(QString::number(::getuid(), 16)); const char* const pcSudoUid(::getenv("SUDO_UID")); if (pcSudoUid) { const int uiSudoUid(::strtol(pcSudoUid, NULL, 0)); if (uiSudoUid) strHexUid = QString::number(uiSudoUid, 16); } else { const char* const pcUser(::getenv("USER")); if (pcUser) { const struct passwd* pPasswd(::getpwnam(pcUser)); if (pPasswd) strHexUid = QString::number(pPasswd->pw_uid, 16); } } return(strHexUid); }
false
false
false
false
false
0
find_next_cell_to_be_splitted(Partition::Cell* cell) { switch(sh) { case shs_f: return sh_first(); case shs_fs: return sh_first_smallest(); case shs_fl: return sh_first_largest(); case shs_fm: return sh_first_max_neighbours(); case shs_fsm: return sh_first_smallest_max_neighbours(); case shs_flm: return sh_first_largest_max_neighbours(); default: fatal_error("Internal error - unknown splitting heuristics"); return 0; } }
false
false
false
false
false
0
tomoyo_write_domain2(struct tomoyo_policy_namespace *ns, struct list_head *list, char *data, const bool is_delete) { struct tomoyo_acl_param param = { .ns = ns, .list = list, .data = data, .is_delete = is_delete, }; static const struct { const char *keyword; int (*write) (struct tomoyo_acl_param *); } tomoyo_callback[5] = { { "file ", tomoyo_write_file }, { "network inet ", tomoyo_write_inet_network }, { "network unix ", tomoyo_write_unix_network }, { "misc ", tomoyo_write_misc }, { "task ", tomoyo_write_task }, }; u8 i; for (i = 0; i < ARRAY_SIZE(tomoyo_callback); i++) { if (!tomoyo_str_starts(&param.data, tomoyo_callback[i].keyword)) continue; return tomoyo_callback[i].write(&param); } return -EINVAL; }
true
true
false
false
false
1
consume(void *data, Query *) { // _filter is 0 --> no filter, accept all data if (!_filter || _filter->accepts(data)) _count++; }
false
false
false
false
false
0
rnd_next(void) { int result; m_pos.set_at(&m_next_pos); if (m_pos.m_index < COUNT_SETUP_TIMERS) { m_row= &all_setup_timers_data[m_pos.m_index]; m_next_pos.set_after(&m_pos); result= 0; } else { m_row= NULL; result= HA_ERR_END_OF_FILE; } return result; }
false
false
false
false
false
0
rename_block_array_entry(Block *bpt, const int cm_entry, const int lm_entry) { Pe_statement *ppt; if (bpt->inner != NULL) { rename_block_next_array_entry(bpt->inner, cm_entry, lm_entry); } for (ppt = bpt->pre_head; ppt != NULL; ppt = ppt->next) { rename_pe_statement_array_entry(ppt, cm_entry, lm_entry); } }
false
false
false
false
false
0
initialize(const MachineFunction &Fn) { releaseMemory(); MF = &Fn; SmallVector<InsnRange, 4> MIRanges; DenseMap<const MachineInstr *, LexicalScope *> MI2ScopeMap; extractLexicalScopes(MIRanges, MI2ScopeMap); if (CurrentFnLexicalScope) { constructScopeNest(CurrentFnLexicalScope); assignInstructionRanges(MIRanges, MI2ScopeMap); } }
false
false
false
false
false
0
assign(const Cff *cff, int pos, int nglyphs, int max_sid, ErrorHandler *errh) { if (!errh) errh = ErrorHandler::silent_handler(); _sids.reserve(nglyphs); if (pos == 0) assign(iso_adobe_charset, sizeof(iso_adobe_charset) / sizeof(int), nglyphs); else if (pos == 1) assign(expert_charset, sizeof(expert_charset) / sizeof(int), nglyphs); else if (pos == 2) assign(expert_subset_charset, sizeof(expert_subset_charset) / sizeof(int), nglyphs); else _error = parse(cff, pos, nglyphs, max_sid, errh); if (_error >= 0) for (int g = 0; g < _sids.size(); g++) { if (_gids[_sids[g]] >= 0) { errh->error("glyph '%s' in charset twice", cff->sid_permstring(_sids[g]).c_str()); _error = -EEXIST; } _gids[_sids[g]] = g; } }
false
false
false
false
false
0
op_sra(uint32_t op, const struct opinfo *oi) { long reg = op & 7; uint8_t res, val; DPRINTF(" %s ", oi->name); print_reg(reg); res = val = get_reg(reg); res = res >> 1; res |= val & 0x80; gbcpu_regs.rn.f = (val & 1) << 4; if (res == 0) gbcpu_regs.rn.f |= ZF; put_reg(reg, res); }
false
false
false
false
false
0
getChangedSuperScript(bool * pbSuperScript) const { if (pbSuperScript) *pbSuperScript = m_bSuperScript; return m_bChangedSuperScript; }
false
false
false
false
false
0
add_choice(struct choice *choices, unsigned *cnt, unsigned i, unsigned ie, enum badness badness) { struct choice *choice; int i_neg = -1; assert(ie < MAXPATLEN); if (ie < i+1) return; if (*cnt >= MAX_CHOICES) return; if (badness > avoid_first && *cnt >= (MAX_CHOICES >> 1)) { unsigned j; /* replace very bad picks if we're full */ for (j=0;j<*cnt;j++) { if (choices[j].base < badness) { if (i_neg == -1 || choices[j].base < choices[i_neg].base) { i_neg = j; } } } } if (i_neg != -1) { choice = &choices[i_neg]; } else { choice = &choices[(*cnt)++]; } choice->begin = i; choice->len = ie - i + 1; choice->base = badness; }
false
false
false
false
false
0
tcos_standalone(xmlrpc_env *const env, xmlrpc_value *const in, void *const serverContext) #else xmlrpc_value *tcos_standalone(xmlrpc_env *env, xmlrpc_value *in, void *ud) #endif { FILE *fp; char line[BIG_BUFFER]; char *info; char *group; size_t *len; char *fret; UNUSED(fret); /* read what info search */ xmlrpc_parse_value(env, in, "(ss#)", &info, &group, &len); dbgtcos("tcosxmlrpc::tcos_standalone() searching for standalone=\"%s\"\n", info); if ( strcmp(info, "get_user") == 0 ) fp=(FILE*)popen(STANDALONE_USER, "r"); else if ( strcmp(info, "get_exclude") == 0 ) { snprintf( line, BSIZE, "%s=%s 2>/dev/null", STANDALONE_EXCLUDE, group); fp=(FILE*)popen(line, "r"); } else if ( strcmp(info, "get_process") == 0 ) fp=(FILE*)popen(STANDALONE_PROCESS, "r"); else if ( strcmp(info, "get_server") == 0 ) { snprintf( line, BSIZE, "%s %s 2>/dev/null", STANDALONE_SERVER, group); fp=(FILE*)popen(line, "r"); } else if ( strcmp(info, "get_multiseat") == 0 ) { snprintf( line, BSIZE, "%s %s 2>/dev/null", STANDALONE_MULTISEAT, group); fp=(FILE*)popen(line, "r"); } else if ( strcmp(info, "get_time") == 0 ) fp=(FILE*)popen(STANDALONE_TIME, "r"); /* default method = error */ else return xmlrpc_build_value(env, "s", STANDALONE_UNKNOW ); if (fp == NULL) return xmlrpc_build_value(env, "s", STANDALONE_UNKNOW ); /* put error into line */ strncpy(line, STANDALONE_ERROR, BIG_BUFFER); fret=fgets( line, sizeof line, fp); remove_line_break(line); pclose(fp); dbgtcos("tcosxmlrpc::tcos_standalone() line=\"%s\"\n", line); return xmlrpc_build_value(env, "s", line ); }
false
false
false
false
false
0
kmemleak_seq_next(struct seq_file *seq, void *v, loff_t *pos) { struct kmemleak_object *prev_obj = v; struct kmemleak_object *next_obj = NULL; struct kmemleak_object *obj = prev_obj; ++(*pos); list_for_each_entry_continue_rcu(obj, &object_list, object_list) { if (get_object(obj)) { next_obj = obj; break; } } put_object(prev_obj); return next_obj; }
false
false
false
false
false
0
on_file_activated (GtkWidget *widget, PdfInspector *inspector) { gchar *file_name; file_name = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (widget)); if (file_name) inspector->load (file_name); g_free (file_name); }
false
false
false
false
false
0
gwy_app_wait_create_dialog(GtkWindow *window, const gchar *message) { dialog = gtk_dialog_new_with_buttons(_("Please wait"), window, GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR | GTK_DIALOG_MODAL, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, NULL); label = gtk_label_new(NULL); gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); gtk_label_set_markup(GTK_LABEL(label), message); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), label, FALSE, FALSE, 4); progress = gtk_progress_bar_new(); gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progress), 0.0); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), progress, FALSE, FALSE, 4); g_signal_connect(dialog, "response", G_CALLBACK(gwy_app_wait_cancelled), NULL); gtk_widget_show_all(dialog); gtk_window_present(GTK_WINDOW(dialog)); while (gtk_events_pending()) gtk_main_iteration(); }
false
false
false
false
false
0
fs_rtp_header_extension_destroy (FsRtpHeaderExtension *extension) { if (extension) { g_free (extension->uri); g_slice_free (FsRtpHeaderExtension, extension); } }
false
false
false
false
false
0
get_hw_packet_type(struct io_buffer *iob) { struct ieee80211_frame *hdr; enum ath9k_pkt_type htype; u16 fc; hdr = (struct ieee80211_frame *)iob->data; fc = hdr->fc; if ((fc & (IEEE80211_FC_TYPE | IEEE80211_FC_SUBTYPE)) == (IEEE80211_TYPE_MGMT | IEEE80211_STYPE_BEACON)) htype = ATH9K_PKT_TYPE_BEACON; else if ((fc & (IEEE80211_FC_TYPE | IEEE80211_FC_SUBTYPE)) == (IEEE80211_TYPE_MGMT | IEEE80211_STYPE_PROBE_RESP)) htype = ATH9K_PKT_TYPE_PROBE_RESP; else htype = ATH9K_PKT_TYPE_NORMAL; return htype; }
false
false
false
false
false
0
OutputInDepth(const unsigned long Depth, const char* Separator) { std::string output = ""; for(unsigned long d=Depth+1; d > 0; d--) output.append(Separator); return output; }
false
false
false
false
false
0
qlcnic_dcb_peer_app_table(struct net_device *netdev, struct dcb_app *table) { struct qlcnic_adapter *adapter = netdev_priv(netdev); struct qlcnic_dcb_cee *peer; struct qlcnic_dcb_app *app; int i, j; if (!test_bit(QLCNIC_DCB_STATE, &adapter->dcb->state)) return 0; peer = &adapter->dcb->cfg->type[QLC_DCB_PEER_IDX]; for (i = 0, j = 0; i < QLC_DCB_MAX_APP; i++) { app = &peer->app[i]; if (!app->valid) continue; table[j].selector = app->selector; table[j].priority = app->priority; table[j++].protocol = app->protocol; } return 0; }
false
false
false
false
false
0
tool_physic_getSymbolFromZ(gchar **name, float *radcov, int zele) { g_return_val_if_fail(zele > 0 && zele < NUMBER_OF_ELEMENTS + 1, FALSE); if (name) *name = eles[zele - 1].name; if (radcov) *radcov = eles[zele - 1].radcov; return TRUE; }
false
false
false
false
false
0
sentinelFailoverReconfNextSlave(sentinelRedisInstance *master) { dictIterator *di; dictEntry *de; int in_progress = 0; di = dictGetIterator(master->slaves); while((de = dictNext(di)) != NULL) { sentinelRedisInstance *slave = dictGetVal(de); if (slave->flags & (SRI_RECONF_SENT|SRI_RECONF_INPROG)) in_progress++; } dictReleaseIterator(di); di = dictGetIterator(master->slaves); while(in_progress < master->parallel_syncs && (de = dictNext(di)) != NULL) { sentinelRedisInstance *slave = dictGetVal(de); int retval; /* Skip the promoted slave, and already configured slaves. */ if (slave->flags & (SRI_PROMOTED|SRI_RECONF_DONE)) continue; /* If too much time elapsed without the slave moving forward to * the next state, consider it reconfigured even if it is not. * Sentinels will detect the slave as misconfigured and fix its * configuration later. */ if ((slave->flags & SRI_RECONF_SENT) && (mstime() - slave->slave_reconf_sent_time) > SENTINEL_SLAVE_RECONF_TIMEOUT) { sentinelEvent(REDIS_NOTICE,"-slave-reconf-sent-timeout",slave,"%@"); slave->flags &= ~SRI_RECONF_SENT; slave->flags |= SRI_RECONF_DONE; } /* Nothing to do for instances that are disconnected or already * in RECONF_SENT state. */ if (slave->flags & (SRI_DISCONNECTED|SRI_RECONF_SENT|SRI_RECONF_INPROG)) continue; /* Send SLAVEOF <new master>. */ retval = sentinelSendSlaveOf(slave, master->promoted_slave->addr->ip, master->promoted_slave->addr->port); if (retval == REDIS_OK) { slave->flags |= SRI_RECONF_SENT; slave->slave_reconf_sent_time = mstime(); sentinelEvent(REDIS_NOTICE,"+slave-reconf-sent",slave,"%@"); in_progress++; } } dictReleaseIterator(di); /* Check if all the slaves are reconfigured and handle timeout. */ sentinelFailoverDetectEnd(master); }
false
false
false
false
false
0
vector_add_ncols_ns(Vector *v, unsigned int n) { unsigned int i; NSData tmpdata; if (!v) { if (MATR_DEBUG_MODE) { fprintf(stderr, "vector_add_ncols: null vector.\n"); } return; } if (n <= 0){ return; } if (v->compact) { if (!(v->was_mapped) || (v->was_mapped && (void *)v + sizeof(Vector) != (void *)(v->data.nsarray.compact))) { v->data.nsarray.compact = (int *)realloc(v->data.nsarray.compact, sizeof(int)*(v->dim+n)); } else { tmpdata.compact = v->data.nsarray.compact; v->data.nsarray.compact = (int *)malloc(sizeof(int)*(v->dim+n)); if (v->data.nsarray.compact) { memcpy(v->data.nsarray.compact, tmpdata.compact, sizeof(int)*v->dim); } } if (!v->data.nsarray.compact) { if (MATR_DEBUG_MODE) { fprintf(stderr, "Error adding a column to non-sparse vector.\n"); } v->dim = 0; v->nz = 0; return; } } else { if (!(v->was_mapped) || (v->was_mapped && (void *)v + sizeof(Vector) != (void *)(v->data.nsarray.precise))) { v->data.nsarray.precise = (double *)realloc(v->data.nsarray.precise, sizeof(double)*(v->dim+n)); } else { tmpdata.precise = v->data.nsarray.precise; v->data.nsarray.precise = (double *)malloc(sizeof(double)*(v->dim+n)); if (v->data.nsarray.precise) { memcpy(v->data.nsarray.precise, tmpdata.precise, sizeof(double)*v->dim); } } if (!v->data.nsarray.precise) { if (MATR_DEBUG_MODE) { fprintf(stderr, "Error adding a column to non-sparse vector.\n"); } v->dim = 0; v->nz = 0; return; } } v->dim += n; for (i = v->dim-n; i < v->dim; i++) { vector_set(v, i, 0); } }
false
true
false
false
false
1
_print_job_job_state_compact(job_info_t * job, int width, bool right, char* suffix) { if (job == NULL) /* Print the Header instead */ _print_str("ST", width, right, true); else _print_str(job_state_string_compact(job->job_state), width, right, true); if (suffix) printf("%s", suffix); return SLURM_SUCCESS; }
false
false
false
false
false
0
xsh_cube_trace_diff(const cpl_table* table, const char* col_comp, const char* col_ref, cpl_propertylist* plist) { char key_name[25]; double cmp_c0=0; double ref_c0=0; double dif_c0=0; double cmp_c1=0; double ref_c1=0; double dif_c1=0; double cmp_c2=0; double ref_c2=0; double dif_c2=0; const double* pw=NULL; double wav=0; double cmp_pos=0; double ref_pos=0; double dif_pos=0; sprintf(key_name,"%s_%s",XSH_QC_TRACE_FIT_C0,col_comp); check(cmp_c0=cpl_propertylist_get_double(plist,key_name)); sprintf(key_name,"%s_%s",XSH_QC_TRACE_FIT_C1,col_comp); cmp_c1=cpl_propertylist_get_double(plist,key_name); sprintf(key_name,"%s_%s",XSH_QC_TRACE_FIT_C2,col_comp); cmp_c2=cpl_propertylist_get_double(plist,key_name); sprintf(key_name,"%s_%s",XSH_QC_TRACE_FIT_C0,col_ref); ref_c0=cpl_propertylist_get_double(plist,key_name); sprintf(key_name,"%s_%s",XSH_QC_TRACE_FIT_C1,col_ref); ref_c1=cpl_propertylist_get_double(plist,key_name); sprintf(key_name,"%s_%s",XSH_QC_TRACE_FIT_C2,col_ref); ref_c2=cpl_propertylist_get_double(plist,key_name); dif_c0=cmp_c0-ref_c0; dif_c1=cmp_c1-ref_c1; dif_c2=cmp_c2-ref_c2; pw=cpl_table_get_data_double_const(table,"WAVELENGTH"); wav=pw[0]; cmp_pos=cmp_c0+cmp_c1*wav+cmp_c2*wav*wav; ref_pos=ref_c0+ref_c1*wav+ref_c2*wav*wav; dif_pos=cmp_pos-ref_pos; cpl_propertylist_append_double(plist,XSH_QC_TRACE_FIT_DIFF_C0,dif_c0); cpl_propertylist_set_comment(plist,XSH_QC_TRACE_FIT_DIFF_C0,"order 0 fit coeff diff"); cpl_propertylist_append_double(plist,XSH_QC_TRACE_FIT_DIFF_C1,dif_c1); cpl_propertylist_set_comment(plist,XSH_QC_TRACE_FIT_DIFF_C1,"order 1 fit coeff diff"); cpl_propertylist_append_double(plist,XSH_QC_TRACE_FIT_DIFF_C1,dif_c2); cpl_propertylist_set_comment(plist,key_name,"order 2 fit coeff diff"); cpl_propertylist_append_double(plist,XSH_QC_TRACE_FIT_DIFF_POS,dif_pos); cpl_propertylist_set_comment(plist,key_name,"fit trace diff pos"); cleanup: return cpl_error_get_code(); }
true
true
false
false
false
1
vgdbOut(const char *fmt, va_list args) { // We protect against reentry because putpacket could try and report // an error which would lead to a call back to vgdbOut static bool reentered = false; if (gdbFileDescriptor >= 0 && !reentered) { char textbuf[BUFMAX], hexbuf[2 * BUFMAX], *textscan, *hexscan; reentered = true; vsnprintf(textbuf, BUFMAX, fmt, args); hexscan = hexbuf; *hexscan++ = 'O'; for (textscan = textbuf; *textscan; textscan++) hexscan = byteToHex(*textscan, hexscan); *hexscan = '\0'; putpacket(hexbuf); reentered = false; } }
false
false
false
false
false
0
radeon_gem_prime_vmap(struct drm_gem_object *obj) { struct radeon_bo *bo = gem_to_radeon_bo(obj); int ret; ret = ttm_bo_kmap(&bo->tbo, 0, bo->tbo.num_pages, &bo->dma_buf_vmap); if (ret) return ERR_PTR(ret); return bo->dma_buf_vmap.virtual; }
false
false
false
false
false
0
compare_arrays(Module_table *mpt, SemBranch *lBranch, SemBranch *rBranch) { int l_array, r_array, i; Array_table *l_arrays, *r_arrays, *l_arrays_head, *r_arrays_head; char *checked; l_arrays_head = construct_arraylist_from_semtree(lBranch); if(l_arrays_head != NULL && l_arrays_head->entry == -1){ free_array_table(l_arrays_head); return FALSE; } l_array = count_arraylist(l_arrays_head); r_arrays_head = construct_arraylist_from_semtree(rBranch); if(r_arrays_head != NULL && r_arrays_head->entry == -1){ free_array_table(l_arrays_head); free_array_table(r_arrays_head); return FALSE; } r_array = count_arraylist(r_arrays_head); checked = calloc(r_array, sizeof(char*)); for(l_arrays = l_arrays_head, r_arrays = r_arrays_head; l_arrays != NULL; l_arrays = l_arrays->next){ Array_table *tr_arrays = NULL; for(tr_arrays = r_arrays, i = 0; tr_arrays != NULL; tr_arrays = tr_arrays->next, i++){ if(checked[i]) continue; if(tr_arrays->entry == l_arrays->entry) { if(!compare_subtree(mpt, get_array_subscript_from_branch(lBranch, tr_arrays->entry), get_array_subscript_from_branch(rBranch, tr_arrays->entry))){ free_array_table(l_arrays_head); free_array_table(r_arrays_head); free(checked); return FALSE; }else{ checked[i] = 1; l_array--; r_array--; break; } } } } free_array_table(l_arrays_head); free_array_table(r_arrays_head); free(checked); if(l_array == 0 && r_array == 0) { return TRUE; } return FALSE; }
false
false
false
false
false
0
is_selected(int dor, int unit) { return ((dor & (0x10 << unit)) && (dor & 3) == unit); }
false
false
false
false
false
0
gx_knob_size_request (GtkWidget *widget, GtkRequisition *requisition) { g_assert(GX_IS_KNOB(widget)); GdkPixbuf *pb = gtk_widget_render_icon(widget, get_stock_id(widget), GtkIconSize(-1), NULL); if (GDK_IS_PIXBUF (pb)) { gint fcount; GdkRectangle rect; get_image_dimensions (widget, pb, &rect, &fcount); requisition->width = rect.width; requisition->height = rect.height; _gx_regler_calc_size_request(GX_REGLER(widget), requisition); g_object_unref(pb); } }
false
false
false
false
false
0
main (int argc, char *argv[]) { long nbtests; mpfr_prec_t prec; int verbose = 0; tests_start_mpfr (); if (argc > 1) verbose = 1; nbtests = 10000; if (argc > 1) { long a = atol(argv[1]); if (a != 0) nbtests = a; } if (argc <= 2) prec = 1000; else prec = atol(argv[2]); test_urandomb (nbtests, prec, verbose); if (argc == 1) /* check also small precision */ { test_urandomb (nbtests, 2, 0); } bug20100914 (); tests_end_mpfr (); return 0; }
false
false
false
false
true
1
window_redraw_top(Win *win) { Line *line = win->cursor.line; for (Line *cur = win->topline; cur && cur != line; cur = cur->next) win->start += cur->len; window_draw(win); window_cursor_to(win, win->cursor.pos); }
false
false
false
false
false
0
io_run_rd(struct io *io, const char **argv, const char *dir, enum format_flags flags) { return io_format(io, dir, IO_RD, argv, flags) && io_start(io); }
false
false
false
false
false
0
flat() { const int index = seq; long seed1 = table[index][0]; long seed2 = table[index][1]; int k1 = (int)(seed1/ecuyer_b); int k2 = (int)(seed2/ecuyer_e); seed1 = ecuyer_a*(seed1-k1*ecuyer_b)-k1*ecuyer_c; if (seed1 < 0) seed1 += shift1; seed2 = ecuyer_d*(seed2-k2*ecuyer_e)-k2*ecuyer_f; if (seed2 < 0) seed2 += shift2; table[index][0] = seed1; table[index][1] = seed2; long diff = seed1-seed2; if (diff <= 0) diff += (shift1-1); return (double)(diff*prec); }
false
false
false
false
false
0
modsin_id1( xml *node, fields *info, int level ) { newstr *ns; ns = xml_getattrib( node, "ID" ); if ( ns ) { fields_add( info, "REFNUM", ns->data, level ); } }
false
false
false
false
false
0
hash_lookup(ht, key, hash) hashtab_T *ht; char_u *key; hash_T hash; { hash_T perturb; hashitem_T *freeitem; hashitem_T *hi; unsigned idx; #ifdef HT_DEBUG ++hash_count_lookup; #endif /* * Quickly handle the most common situations: * - return if there is no item at all * - skip over a removed item * - return if the item matches */ idx = (unsigned)(hash & ht->ht_mask); hi = &ht->ht_array[idx]; if (hi->hi_key == NULL) return hi; if (hi->hi_key == HI_KEY_REMOVED) freeitem = hi; else if (hi->hi_hash == hash && STRCMP(hi->hi_key, key) == 0) return hi; else freeitem = NULL; /* * Need to search through the table to find the key. The algorithm * to step through the table starts with large steps, gradually becoming * smaller down to (1/4 table size + 1). This means it goes through all * table entries in the end. * When we run into a NULL key it's clear that the key isn't there. * Return the first available slot found (can be a slot of a removed * item). */ for (perturb = hash; ; perturb >>= PERTURB_SHIFT) { #ifdef HT_DEBUG ++hash_count_perturb; /* count a "miss" for hashtab lookup */ #endif idx = (unsigned)((idx << 2U) + idx + perturb + 1U); hi = &ht->ht_array[idx & ht->ht_mask]; if (hi->hi_key == NULL) return freeitem == NULL ? hi : freeitem; if (hi->hi_hash == hash && hi->hi_key != HI_KEY_REMOVED && STRCMP(hi->hi_key, key) == 0) return hi; if (hi->hi_key == HI_KEY_REMOVED && freeitem == NULL) freeitem = hi; } }
false
false
false
false
false
0
pointInsideTriangle(Point3 point, Point3** tri_points, Point3 tri_center, double tri_radius) { Point3 tmp, tmp1, tmp2; Point3* tp0 = tri_points[0]; Point3* tp1 = tri_points[1]; Point3* tp2 = tri_points[2]; /* -First trivial distance check * Compare point distance from the center of the triangle * with the "radius" of the triangle */ diff3(tri_center, point, tmp); if ( isGreater( dot3(tmp, tmp), tri_radius) ) { return false; } /*-Check if it remains between edges looked from * vertices * First look from p0 */ diff3(point, *tp0, tmp); diff3(*tp1, *tp0, tmp1); diff3(*tp2, *tp0, tmp2); normalize(tmp); normalize(tmp1); normalize(tmp2); /* if too much "left" */ if ( dot3(tmp1, tmp2) > dot3(tmp1, tmp) ) { return false; } /* if too much "right" */ if ( dot3(tmp2, tmp1) > dot3(tmp2, tmp) ) { return false; } /* Then look from p2 */ diff3(point, *tp2, tmp); diff3(*tp1, *tp2, tmp1); diff3(*tp0, *tp2, tmp2); normalize(tmp); normalize(tmp1); normalize(tmp2); /* if too much "left" */ if ( dot3(tmp2, tmp1) > dot3(tmp2, tmp) ) { return false; } /* if too much "right" */ if ( dot3(tmp1, tmp2) > dot3(tmp1, tmp) ) { return false; } return true; }
false
false
false
false
false
0
test(char *URL) { CURL *curl; CURLcode res=CURLE_OK; if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { fprintf(stderr, "curl_global_init() failed\n"); return TEST_ERR_MAJOR_BAD; } if ((curl = curl_easy_init()) == NULL) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; } /* First set the URL that is about to receive our POST. */ test_setopt(curl, CURLOPT_URL, URL); test_setopt(curl, CURLOPT_POSTFIELDS, NULL); test_setopt(curl, CURLOPT_POSTFIELDSIZE, 0L); test_setopt(curl, CURLOPT_VERBOSE, 1L); /* show verbose for debug */ test_setopt(curl, CURLOPT_HEADER, 1L); /* include header */ /* Now, we should be making a zero byte POST request */ res = curl_easy_perform(curl); test_cleanup: /* always cleanup */ curl_easy_cleanup(curl); curl_global_cleanup(); return (int)res; }
false
false
false
false
false
0
create_context() { struct context *new_context; if ( (new_context=(struct context *)malloc(sizeof(struct context))) == NULL ) return NULL; new_context->match_regex_str=NULL; new_context->match_regex=NULL; new_context->match_not_regex_str=NULL; new_context->match_not_regex=NULL; new_context->max_lines=LONG_MAX; new_context->min_lines=0; new_context->timeout_abs=LONG_MAX; new_context->timeout_rel=LONG_MAX; new_context->timeout_rel_offset=0; new_context->action_type=ACTION_UNKNOWN; new_context->action_tokens=NULL; new_context->body=NULL; new_context->lines=0; new_context->last=NULL; new_context->next=NULL; new_context->previous=NULL; return(new_context); }
false
false
false
false
false
0
parse_padding (CRTerm const **value, ccss_padding_t *padding) { padding->base.state = ccss_property_parse_state (value); if (CCSS_PROPERTY_STATE_SET == padding->base.state && *value && TERM_NUMBER == (*value)->type) { padding->padding = (*value)->content.num->val; (*value) = (*value)->next; padding->base.state = CCSS_PROPERTY_STATE_SET; return true; } return false; }
false
false
false
false
false
0
chip_cmd(struct CHIPSTATE *chip, char *name, audiocmd *cmd) { struct v4l2_subdev *sd = &chip->sd; struct i2c_client *c = v4l2_get_subdevdata(sd); int i; if (0 == cmd->count) return 0; if (cmd->count + cmd->bytes[0] - 1 >= ARRAY_SIZE(chip->shadow.bytes)) { v4l2_info(sd, "Tried to access a non-existent register range: %d to %d\n", cmd->bytes[0] + 1, cmd->bytes[0] + cmd->count - 1); return -EINVAL; } /* FIXME: it seems that the shadow bytes are wrong below !*/ /* update our shadow register set; print bytes if (debug > 0) */ v4l2_dbg(1, debug, sd, "chip_cmd(%s): reg=%d, data:", name, cmd->bytes[0]); for (i = 1; i < cmd->count; i++) { if (debug) printk(KERN_CONT " 0x%x", cmd->bytes[i]); chip->shadow.bytes[i+cmd->bytes[0]] = cmd->bytes[i]; } if (debug) printk(KERN_CONT "\n"); /* send data to the chip */ if (cmd->count != i2c_master_send(c, cmd->bytes, cmd->count)) { v4l2_warn(sd, "I/O error (%s)\n", name); return -1; } return 0; }
false
false
false
false
false
0
send_ruleset_governments(struct conn_list *dest) { struct packet_ruleset_government gov; struct packet_ruleset_government_ruler_title title; int j; governments_iterate(g) { /* send one packet_government */ gov.id = government_number(g); j = 0; requirement_vector_iterate(&g->reqs, preq) { gov.reqs[j++] = *preq; } requirement_vector_iterate_end; gov.reqs_count = j; sz_strlcpy(gov.name, untranslated_name(&g->name)); sz_strlcpy(gov.rule_name, rule_name(&g->name)); sz_strlcpy(gov.graphic_str, g->graphic_str); sz_strlcpy(gov.graphic_alt, g->graphic_alt); PACKET_STRVEC_COMPUTE(gov.helptext, g->helptext); lsend_packet_ruleset_government(dest, &gov); /* Send one packet_government_ruler_title per ruler title. */ ruler_titles_iterate(government_ruler_titles(g), pruler_title) { const struct nation_type *pnation = ruler_title_nation(pruler_title); title.gov = government_number(g); title.nation = (NULL != pnation ? nation_number(pnation) : -1); sz_strlcpy(title.male_title, ruler_title_male_untranslated_name(pruler_title)); sz_strlcpy(title.female_title, ruler_title_female_untranslated_name(pruler_title)); lsend_packet_ruleset_government_ruler_title(dest, &title); } ruler_titles_iterate_end; } governments_iterate_end; }
false
false
false
false
false
0
ParseBody() { int len = 0; const char* start = readBuffer_.GetContentStart(); const char* end = readBuffer_.GetContentEnd(); if (request_.GetHttpMethod() != HttpRequest::HM_POST) { len += end - start; readBuffer_.ConsumeBuffer(end - start); FinishParsingBody(); return 1; } size_t contentLen = request_.GetBodyLength(); if (contentLen == 0) { std::string clen = request_.GetHeaderValue("Content-Length"); if (clen.empty()) return len; // no body contentLen = atoi(clen.c_str()); if (contentLen == 0) return len; else if (contentLen >= HttpRequest::MaxBodyLength) return -1; request_.SetBodySize(contentLen); } size_t len_of_data_received = request_.GetCurBodyLength(); if (len_of_data_received >= contentLen) return len; size_t left = contentLen - len_of_data_received; if (size_t(end - start) > left) return -1; else if (size_t(end - start) == left) FinishParsingBody(); request_.AppendBody(start, end); len += end - start; readBuffer_.ConsumeBuffer(end - start); return len; }
false
false
false
false
false
0
ibus_bus_exit_async (IBusBus *bus, gboolean restart, gint timeout_msec, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) { g_return_if_fail (IBUS_IS_BUS (bus)); ibus_bus_call_async (bus, IBUS_SERVICE_IBUS, IBUS_PATH_IBUS, IBUS_INTERFACE_IBUS, "Exit", g_variant_new ("(b)", restart), NULL, ibus_bus_exit_async, timeout_msec, cancellable, callback, user_data); }
false
false
false
false
false
0
__txn_add_buffer(env, td) ENV *env; TXN_DETAIL *td; { DB_ASSERT(env, td != NULL); MUTEX_LOCK(env, td->mvcc_mtx); DB_ASSERT(env, td->mvcc_ref < UINT32_MAX); ++td->mvcc_ref; MUTEX_UNLOCK(env, td->mvcc_mtx); COMPQUIET(env, NULL); return (0); }
false
false
false
false
false
0
DecodeBaseAddSubImm(llvm::MCInst &Inst, uint32_t insn, uint64_t Addr, const void *Decoder) { unsigned Rd = fieldFromInstruction(insn, 0, 5); unsigned Rn = fieldFromInstruction(insn, 5, 5); unsigned Imm = fieldFromInstruction(insn, 10, 14); unsigned S = fieldFromInstruction(insn, 29, 1); unsigned Datasize = fieldFromInstruction(insn, 31, 1); unsigned ShifterVal = (Imm >> 12) & 3; unsigned ImmVal = Imm & 0xFFF; const AArch64Disassembler *Dis = static_cast<const AArch64Disassembler *>(Decoder); if (ShifterVal != 0 && ShifterVal != 1) return Fail; if (Datasize) { if (Rd == 31 && !S) DecodeGPR64spRegisterClass(Inst, Rd, Addr, Decoder); else DecodeGPR64RegisterClass(Inst, Rd, Addr, Decoder); DecodeGPR64spRegisterClass(Inst, Rn, Addr, Decoder); } else { if (Rd == 31 && !S) DecodeGPR32spRegisterClass(Inst, Rd, Addr, Decoder); else DecodeGPR32RegisterClass(Inst, Rd, Addr, Decoder); DecodeGPR32spRegisterClass(Inst, Rn, Addr, Decoder); } if (!Dis->tryAddingSymbolicOperand(Inst, Imm, Addr, Fail, 0, 4)) Inst.addOperand(MCOperand::createImm(ImmVal)); Inst.addOperand(MCOperand::createImm(12 * ShifterVal)); return Success; }
false
false
false
false
false
0
trace_msg_cmd(struct scsi_cmnd *srb, struct rtsx_chip *chip) { unsigned char *ptr, *buf = NULL; int i, msg_cnt; u8 clear; unsigned int buf_len; buf_len = 4 + ((2 + MSG_FUNC_LEN + MSG_FILE_LEN + TIME_VAL_LEN) * TRACE_ITEM_CNT); if ((scsi_bufflen(srb) < buf_len) || (scsi_sglist(srb) == NULL)) { set_sense_type(chip, SCSI_LUN(srb), SENSE_TYPE_MEDIA_UNRECOVER_READ_ERR); rtsx_trace(chip); return TRANSPORT_FAILED; } clear = srb->cmnd[2]; buf = vmalloc(scsi_bufflen(srb)); if (buf == NULL) { rtsx_trace(chip); return TRANSPORT_ERROR; } ptr = buf; if (chip->trace_msg[chip->msg_idx].valid) msg_cnt = TRACE_ITEM_CNT; else msg_cnt = chip->msg_idx; *(ptr++) = (u8)(msg_cnt >> 24); *(ptr++) = (u8)(msg_cnt >> 16); *(ptr++) = (u8)(msg_cnt >> 8); *(ptr++) = (u8)msg_cnt; dev_dbg(rtsx_dev(chip), "Trace message count is %d\n", msg_cnt); for (i = 1; i <= msg_cnt; i++) { int j, idx; idx = chip->msg_idx - i; if (idx < 0) idx += TRACE_ITEM_CNT; *(ptr++) = (u8)(chip->trace_msg[idx].line >> 8); *(ptr++) = (u8)(chip->trace_msg[idx].line); for (j = 0; j < MSG_FUNC_LEN; j++) *(ptr++) = chip->trace_msg[idx].func[j]; for (j = 0; j < MSG_FILE_LEN; j++) *(ptr++) = chip->trace_msg[idx].file[j]; for (j = 0; j < TIME_VAL_LEN; j++) *(ptr++) = chip->trace_msg[idx].timeval_buf[j]; } rtsx_stor_set_xfer_buf(buf, scsi_bufflen(srb), srb); vfree(buf); if (clear) { chip->msg_idx = 0; for (i = 0; i < TRACE_ITEM_CNT; i++) chip->trace_msg[i].valid = 0; } scsi_set_resid(srb, 0); return TRANSPORT_GOOD; }
false
false
false
false
false
0
sge_ssl_get_rand_file_path(char *rand_file) { const char *key = getenv("SGE_RANDFILE"); DENTER(TOP_LAYER, "sge_ssl_get_rand_file_path"); if (key != NULL) { sge_strlcpy(rand_file, key, SGE_PATH_MAX); } else { const char *ca_local_dir = "/var/sgeCA"; const char *sge_cell = sge_get_default_cell(); const char *user_key = "private/rand.seed"; const char *sge_qmaster_port = getenv("SGE_QMASTER_PORT"); if (sge_qmaster_port != NULL) { snprintf(rand_file, SGE_PATH_MAX, "%s/port%s/%s/%s", ca_local_dir, sge_qmaster_port, sge_cell, user_key); } else { snprintf(rand_file, SGE_PATH_MAX, "%s/sge_qmaster/%s/%s", ca_local_dir, sge_cell, user_key); } } DEXIT; return 0; }
false
false
false
false
false
0
adns__must_gettimeofday(adns_state ads, const struct timeval **now_io, struct timeval *tv_buf) { const struct timeval *now; int r; now= *now_io; if (now) return; r= gettimeofday(tv_buf,0); if (!r) { *now_io= tv_buf; return; } adns__diag(ads,-1,0,"gettimeofday failed: %s",strerror(errno)); adns_globalsystemfailure(ads); return; }
false
false
false
false
false
0
radeon_atpx_get_client_id(struct pci_dev *pdev) { if (radeon_atpx_priv.dhandle == ACPI_HANDLE(&pdev->dev)) return VGA_SWITCHEROO_IGD; else return VGA_SWITCHEROO_DIS; }
false
false
false
false
false
0
server_event_connect (jack_client_t *client, const char *server_name) { int fd; struct sockaddr_un addr; jack_client_connect_ack_request_t req; jack_client_connect_ack_result_t res; char server_dir[PATH_MAX+1] = ""; if ((fd = socket (AF_UNIX, SOCK_STREAM, 0)) < 0) { jack_error ("cannot create client event socket (%s)", strerror (errno)); return -1; } addr.sun_family = AF_UNIX; snprintf (addr.sun_path, sizeof (addr.sun_path) - 1, "%s/jack_ack_0", jack_server_dir (server_name,server_dir)); if (connect (fd, (struct sockaddr *) &addr, sizeof (addr)) < 0) { jack_error ("cannot connect to jack server for events", strerror (errno)); close (fd); return -1; } req.client_id = client->control->id; if (write (fd, &req, sizeof (req)) != sizeof (req)) { jack_error ("cannot write event connect request to server (%s)", strerror (errno)); close (fd); return -1; } if (read (fd, &res, sizeof (res)) != sizeof (res)) { jack_error ("cannot read event connect result from server (%s)", strerror (errno)); close (fd); return -1; } if (res.status != 0) { jack_error ("cannot connect to server for event stream (%s)", strerror (errno)); close (fd); return -1; } return fd; }
true
true
false
false
true
1
check_address (const char *address, DBusError *error) { DBusAddressEntry **entries; DBusTransport *transport = NULL; int len, i; _dbus_assert (address != NULL); if (!dbus_parse_address (address, &entries, &len, error)) return NULL; /* not a valid address */ for (i = 0; i < len; i++) { transport = _dbus_transport_open (entries[i], error); if (transport != NULL) break; } dbus_address_entries_free (entries); return transport; }
false
false
false
false
false
0
check_keys(GKeyFile *keyfile, const char *group, const char **possible_keys) { char **avail_keys; gsize nb_avail_keys, i, j; avail_keys = g_key_file_get_keys(keyfile, group, &nb_avail_keys, NULL); if (avail_keys == NULL) return; /* * For each key in the configuration file, * verify it is understood by connman */ for (i = 0 ; i < nb_avail_keys; i++) { for (j = 0; possible_keys[j] ; j++) if (g_strcmp0(avail_keys[i], possible_keys[j]) == 0) break; if (possible_keys[j] == NULL) connman_warn("Unknown configuration key %s in [%s]", avail_keys[i], group); } g_strfreev(avail_keys); }
false
false
false
false
true
1
crypto_hash_walk_done(struct crypto_hash_walk *walk, int err) { unsigned int alignmask = walk->alignmask; unsigned int nbytes = walk->entrylen; walk->data -= walk->offset; if (nbytes && walk->offset & alignmask && !err) { walk->offset = ALIGN(walk->offset, alignmask + 1); walk->data += walk->offset; nbytes = min(nbytes, ((unsigned int)(PAGE_SIZE)) - walk->offset); walk->entrylen -= nbytes; return nbytes; } if (walk->flags & CRYPTO_ALG_ASYNC) kunmap(walk->pg); else { kunmap_atomic(walk->data); /* * The may sleep test only makes sense for sync users. * Async users don't need to sleep here anyway. */ crypto_yield(walk->flags); } if (err) return err; if (nbytes) { walk->offset = 0; walk->pg++; return hash_walk_next(walk); } if (!walk->total) return 0; walk->sg = sg_next(walk->sg); return hash_walk_new_entry(walk); }
false
false
false
false
false
0
IncrBufferRefCount(Buffer buffer) { Assert(BufferIsPinned(buffer)); ResourceOwnerEnlargeBuffers(CurrentResourceOwner); ResourceOwnerRememberBuffer(CurrentResourceOwner, buffer); if (BufferIsLocal(buffer)) LocalRefCount[-buffer - 1]++; else PrivateRefCount[buffer - 1]++; }
false
false
false
false
false
0
qvariant_to_object(const QVariant *vp, const QMetaObject *mo) { QObject *obj = qvariant_to_object(vp); if (obj && mo) { const QMetaObject *m = obj->metaObject(); while (m && m != mo) m = m->superClass(); if (m != mo) obj = 0; } return obj; }
false
false
false
false
false
0
DrawCursor(int Show) { if (CursorVisible) { TCell *Cell = CursorXYPos(CursorX, CursorY); // Check if cursor is on or off due to flashing if (CursorBlink) Show &= (CursorLastTime % (CursorFlashInterval * 2)) > CursorFlashInterval; int attr = Cell->GetAttr() ^ (Show ? 0xff : 0); char ch = (char) Cell->GetChar(); if (!useXMB) XDrawImageString(display, win, colorXGC->GetGC(attr), CursorX * FontCX, font_struct->max_bounds.ascent + CursorY * FontCY, &ch, 1); #ifdef CONFIG_X11_XMB else XmbDrawImageString(display, win, font_set, colorXGC->GetGC(attr), CursorX * FontCX, FontCYD + CursorY * FontCY, &ch, 1); #endif #if 0 if (Show) { int cs = (CursorStart * FontCY + FontCY / 2) / 100; int ce = (CursorEnd * FontCY + FontCY / 2) / 100; XFillRectangle (display, win, GCs[p[1]], CursorX * FontCX, CursorY * FontCY + cs, FontCX, ce - cs); } #endif } }
false
false
false
false
false
0
AssembleOutputConnectivity( vtkIdType timeStep, int otyp, int oidx, int conntypidx, BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output ) { // FIXME: Don't think I need this, since we ShallowCopy over it... right? output->Reset(); if ( bsinfop->CachedConnectivity ) { output->ShallowCopy( bsinfop->CachedConnectivity ); return 1; } // OK, we needed to remake the cache... bsinfop->CachedConnectivity = vtkUnstructuredGrid::New(); bsinfop->CachedConnectivity->Allocate( bsinfop->Size ); if ( this->SqueezePoints ) { bsinfop->NextSqueezePoint = 0; bsinfop->PointMap.clear(); bsinfop->ReversePointMap.clear(); } // Need to assemble connectivity array from smaller ones. // Call GetCacheOrRead() for each smaller array // Might want to experiment with the effectiveness of caching connectivity... // set up the ExodusIICache class with the ability to never cache some // key types. // Might also want to experiment with policies other than LRU, especially // applied to arrays that are not time-varying. During animations, they // will most likely get dropped even though that might not be wise. if ( CONNTYPE_IS_BLOCK(conntypidx) ) { this->InsertBlockCells( otyp, oidx, conn_types[conntypidx], timeStep, static_cast<BlockInfoType*>( bsinfop ) ); } else if ( CONNTYPE_IS_SET(conntypidx) ) { this->InsertSetCells( otyp, oidx, conn_types[conntypidx], timeStep, static_cast<SetInfoType*>( bsinfop ) ); } else { vtkErrorMacro( "Bad connectivity object type. Harass the responsible programmer." ); } // OK, now copy our cache to the output... output->ShallowCopy( bsinfop->CachedConnectivity ); //this->CachedConnectivity->ShallowCopy( output ); if ( this->SqueezePoints ) { vtkDebugMacro( << "Squeezed down to " << bsinfop->NextSqueezePoint << " points\n" ); } return 0; }
false
false
false
false
false
0
JS_EvaluateUCScriptForPrincipals(JSContext *cx, JSObject *obj, JSPrincipals *principals, const jschar *chars, uintN length, const char *filename, uintN lineno, jsval *rval) { JSScript *script; JSBool ok; CHECK_REQUEST(cx); script = JSCompiler::compileScript(cx, obj, NULL, principals, !rval ? TCF_COMPILE_N_GO | TCF_NO_SCRIPT_RVAL : TCF_COMPILE_N_GO, chars, length, NULL, filename, lineno); if (!script) { LAST_FRAME_CHECKS(cx, script); return JS_FALSE; } ok = js_Execute(cx, obj, script, NULL, 0, rval); LAST_FRAME_CHECKS(cx, ok); JS_DestroyScript(cx, script); return ok; }
false
false
false
false
false
0
handleRMAEnd( void *firsthandlerarg, uint64_t time, uint32_t process, uint32_t remote, uint32_t communicator, uint32_t tag, uint32_t scltoken, OTF_KeyValueList* list ) { Control* control= (Control*) firsthandlerarg; while ( control->checkTime( time ) ) ; if ( control->copyEvents ) return ( 0 == OTF_Writer_writeRMAEndKV( control->writer, time, process, remote, communicator, tag, scltoken, list ) ) ? OTF_RETURN_ABORT : OTF_RETURN_OK; return OTF_RETURN_OK; }
false
false
false
false
false
0
GDrawDrawArc(GWindow w, GRect *rect, int32 sangle, int32 tangle, Color col) { if ( col!=COLOR_UNKNOWN ) (w->display->funcs->drawArc)(w,rect,sangle,tangle,col); }
false
false
false
false
false
0
Dlopen() /*{{{*/ { // alread open if(libudev_handle != NULL) return true; // see if we can get libudev void *h = ::dlopen("libudev.so.0", RTLD_LAZY); if(h == NULL) return false; // get the pointers to the udev structs libudev_handle = h; udev_new = (udev* (*)(void)) dlsym(h, "udev_new"); udev_enumerate_add_match_property = (int (*)(udev_enumerate*, const char*, const char*))dlsym(h, "udev_enumerate_add_match_property"); udev_enumerate_add_match_sysattr = (int (*)(udev_enumerate*, const char*, const char*))dlsym(h, "udev_enumerate_add_match_sysattr"); udev_enumerate_scan_devices = (int (*)(udev_enumerate*))dlsym(h, "udev_enumerate_scan_devices"); udev_enumerate_get_list_entry = (udev_list_entry* (*)(udev_enumerate*))dlsym(h, "udev_enumerate_get_list_entry"); udev_device_new_from_syspath = (udev_device* (*)(udev*, const char*))dlsym(h, "udev_device_new_from_syspath"); udev_enumerate_get_udev = (udev* (*)(udev_enumerate*))dlsym(h, "udev_enumerate_get_udev"); udev_list_entry_get_name = (const char* (*)(udev_list_entry*))dlsym(h, "udev_list_entry_get_name"); udev_device_get_devnode = (const char* (*)(udev_device*))dlsym(h, "udev_device_get_devnode"); udev_enumerate_new = (udev_enumerate* (*)(udev*))dlsym(h, "udev_enumerate_new"); udev_list_entry_get_next = (udev_list_entry* (*)(udev_list_entry*))dlsym(h, "udev_list_entry_get_next"); udev_device_get_property_value = (const char* (*)(udev_device *, const char *))dlsym(h, "udev_device_get_property_value"); return true; }
false
false
false
false
false
0
CMod_LoadPlanes (const lump_t *l) { int i, j; cplane_t *out; const dplane_t *in; int count; int bits; in = (void *)(cmod_base + l->fileofs); if (l->filelen % sizeof(*in)) Com_Error (ERR_DROP, "CMod_LoadPlanes: funny lump size"); count = l->filelen / sizeof(*in); if (count < 1) Com_Error (ERR_DROP, "Map with no planes"); // need to save space for box planes if (count > MAX_MAP_PLANES) Com_Error (ERR_DROP, "Map has too many planes"); out = map_planes; numplanes = count; for ( i=0 ; i<count ; i++, in++, out++) { bits = 0; for (j=0 ; j<3 ; j++) { out->normal[j] = LittleFloat (in->normal[j]); if (out->normal[j] < 0) bits |= 1<<j; } out->dist = LittleFloat (in->dist); out->type = LittleLong (in->type); out->signbits = bits; } }
false
false
false
false
false
0
p_hit_top_bottom(Paddle *p) { if(p->y <= PONG_TMARG) { p->y = PONG_TMARG; } if((p->y + p->h) >= PONG_H) { p->y = PONG_H - p->h; } }
false
false
false
false
false
0
mdio_sync (void __iomem *ioaddr) { int i; for (i = 32; i >= 0; i--) { RTL_W8 (Config4, MDIO_WRITE1); mdio_delay (); RTL_W8 (Config4, MDIO_WRITE1 | MDIO_CLK); mdio_delay (); } }
false
false
false
false
false
0
print_spike( nd, spk, ch_delay, dr_delay ) nptr nd; pspk spk; Ulong ch_delay, dr_delay; { lprintf( stdout, " [event %s->%c @ %.2f] causes ", pnode( cur_node ), vchars[ cur_node->npot ], d2ns( cur_delta ) ); if( dr_delay <= ch_delay ) lprintf( stdout, "suppressed " ); lprintf( stdout, "spike for %s: %c -> %c -> %c", pnode( nd ), vchars[ nd->npot ], vchars[ spk->charge ], vchars[ nd->npot ] ); lprintf( stdout, " (peak=%.2f delay: ch=%.2fns, dr=%.2fns)\n", spk->peak, d2ns( ch_delay ), d2ns( dr_delay ) ); }
false
false
false
false
false
0
ary_double_capa(VALUE ary, long min) { long new_capa = ARY_CAPA(ary) / 2; if (new_capa < ARY_DEFAULT_SIZE) { new_capa = ARY_DEFAULT_SIZE; } if (new_capa >= ARY_MAX_SIZE - min) { new_capa = (ARY_MAX_SIZE - min) / 2; } new_capa += min; ary_resize_capa(ary, new_capa); }
false
false
false
false
false
0
luaH_getany (lua_State *L, const Hash *t, const TObject *key) { Node *n = luaH_mainposition(t, key); if (!n) lua_error(L, "table index is nil"); else do { if (luaO_equalObj(key, &n->key)) return &n->val; n = n->next; } while (n); return &luaO_nilobject; /* key not found */ }
false
false
false
false
false
0
rs_printmatINT(char const *vecstr, int **x, const int m, const int n) { int i, j; printf("%s :\n", vecstr); for(i=0; i<m; i++){ for(j=0; j<n; j++){ printf(" %4d", x[i][j]); } printf("\n"); } printf("\n"); }
false
false
false
false
false
0
gd_tagged_entry_add_tag (GdTaggedEntry *self, const gchar *id, const gchar *name) { GdTaggedEntryTag *tag; if (gd_tagged_entry_find_tag_by_id (self, id) != NULL) return FALSE; tag = gd_tagged_entry_tag_new (id, name); self->priv->tags = g_list_append (self->priv->tags, tag); if (gtk_widget_get_mapped (GTK_WIDGET (self))) { gd_tagged_entry_tag_realize (tag, self); gdk_window_show_unraised (tag->window); } gtk_widget_queue_resize (GTK_WIDGET (self)); return TRUE; }
false
false
false
false
false
0
compareWORD(const void *a, const void *b) { if (((ParsedWord *) a)->len == ((ParsedWord *) b)->len) { int res = strncmp( ((ParsedWord *) a)->word, ((ParsedWord *) b)->word, ((ParsedWord *) b)->len); if (res == 0) { if (((ParsedWord *) a)->pos.pos == ((ParsedWord *) b)->pos.pos) return 0; return (((ParsedWord *) a)->pos.pos > ((ParsedWord *) b)->pos.pos) ? 1 : -1; } return res; } return (((ParsedWord *) a)->len > ((ParsedWord *) b)->len) ? 1 : -1; }
false
false
false
false
false
0
jabber_handle(void *data, xmlnode_t *n) { session_t *s = (session_t *) data; jabber_private_t *j; const struct jabber_generic_handler *tmp; if (!s || !(j = s->priv) || !n) { debug_error("jabber_handle() invalid parameters\n"); return; } /* jabber handlers */ for (tmp = jabber_handlers; tmp->name; tmp++) { if (!xstrcmp(n->name, tmp->name)) { tmp->handler(s, n); return; } } if (!j->istlen) { debug_error("[jabber] what's that: %s ?\n", n->name); return; } /* tlen handlers */ for (tmp = tlen_handlers; tmp->name; tmp++) { if (!xstrcmp(n->name, tmp->name)) { tmp->handler(s, n); return; } } debug_error("[tlen] what's that: %s ?\n", n->name); }
true
true
false
false
false
1
cards_hand_num_suit(CardsHand *hand, gint suit) { GList *i; Card *card; gint result = 0; i = hand->list; while (i != NULL) { card = (Card*)i->data; if (card->suit == suit) result++; i = g_list_next(i); } return result; }
false
false
false
false
false
0
enmkallcap(char * d, const char * p, const char * encoding) { struct cs_info * csconv = get_current_cs(encoding); while (*p != '\0') { *d++ = csconv[((unsigned char) *p)].cupper; p++; } *d = '\0'; }
false
false
false
false
false
0
refreshMatViewData(Archive *fout, TableDataInfo *tdinfo) { TableInfo *tbinfo = tdinfo->tdtable; PQExpBuffer q; /* If the materialized view is not flagged as populated, skip this. */ if (!tbinfo->relispopulated) return; q = createPQExpBuffer(); appendPQExpBuffer(q, "REFRESH MATERIALIZED VIEW %s;\n", fmtId(tbinfo->dobj.name)); ArchiveEntry(fout, tdinfo->dobj.catId, /* catalog ID */ tdinfo->dobj.dumpId, /* dump ID */ tbinfo->dobj.name, /* Name */ tbinfo->dobj.namespace->dobj.name, /* Namespace */ NULL, /* Tablespace */ tbinfo->rolname, /* Owner */ false, /* with oids */ "MATERIALIZED VIEW DATA", /* Desc */ SECTION_POST_DATA, /* Section */ q->data, /* Create */ "", /* Del */ NULL, /* Copy */ tdinfo->dobj.dependencies, /* Deps */ tdinfo->dobj.nDeps, /* # Deps */ NULL, /* Dumper */ NULL); /* Dumper Arg */ destroyPQExpBuffer(q); }
false
false
false
false
false
0
do_orgchartlink( dsgwtmplinfo *tip, char *dn, unsigned long dispopts, int argc, char **argv ) { struct berval **ldvals = dsgw_get_values(tip->dsti_ld, tip->dsti_entry, gc->gc_orgchartsearchattr); char *escaped_value; if (gc->gc_orgcharturl == NULL || ldvals == NULL || *ldvals == NULL || (*ldvals)->bv_val == NULL || strcmp((*ldvals)->bv_val, "") == 0) { dsgw_emits("\"javascript:void(0)\""); return; } dsgw_emits("\""); dsgw_emits(gc->gc_orgcharturl); escaped_value = dsgw_ch_malloc( 3 * strlen( ldvals[0]->bv_val ) + 1 ); *escaped_value = '\0'; dsgw_strcat_escaped( escaped_value, ldvals[0]->bv_val); dsgw_emits(escaped_value); dsgw_emits("\"\n"); return; }
false
false
false
false
false
0
span_schedule_event(span_sched_state_t *s, int us, span_sched_callback_func_t function, void *user_data) { int i; for (i = 0; i < s->max_to_date; i++) { if (s->sched[i].callback == NULL) break; /*endif*/ } /*endfor*/ if (i >= s->allocated) { s->allocated += 5; s->sched = (span_sched_t *) realloc(s->sched, sizeof(span_sched_t)*s->allocated); } /*endif*/ if (i >= s->max_to_date) s->max_to_date = i + 1; /*endif*/ s->sched[i].when = s->ticker + us; s->sched[i].callback = function; s->sched[i].user_data = user_data; return i; }
false
false
false
false
false
0
__ecereInstMeth___ecereNameSpace__ecere__gui__controls__EditBox_NotifyKeyDown__00000001(struct __ecereNameSpace__ecere__com__Instance * this, struct __ecereNameSpace__ecere__com__Instance * editBox, unsigned int key, unsigned int ch) { struct CallStackView * __ecerePointer_CallStackView = (struct CallStackView *)(this ? (((char *)this) + __ecereClass_CallStackView->offset) : 0); if(key == 0x1C || key == 0x60) { int frameIndex = -1; if(strcmp(__ecereProp___ecereNameSpace__ecere__gui__controls__EditLine_Get_text(__ecereProp___ecereNameSpace__ecere__gui__controls__EditBox_Get_line(editBox)), "...")) frameIndex = atoi(__ecereProp___ecereNameSpace__ecere__gui__controls__EditLine_Get_text(__ecereProp___ecereNameSpace__ecere__gui__controls__EditBox_Get_line(editBox))); ((void (*)(struct __ecereNameSpace__ecere__com__Instance *, int frameIndex))__extension__ ({ struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = this; __internal_ClassInst ? __internal_ClassInst->_vTbl : __ecereClass_CallStackView->_vTbl; })[__ecereVMethodID_CallStackView_OnSelectFrame])(this, frameIndex); return 0x0; } if(key == 0x43) { ((void (*)(struct __ecereNameSpace__ecere__com__Instance *))__extension__ ({ struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = this; __internal_ClassInst ? __internal_ClassInst->_vTbl : __ecereClass_CallStackView->_vTbl; })[__ecereVMethodID_CallStackView_OnToggleBreakpoint])(this); return 0x0; } return 0x1; }
false
false
false
false
false
0
crypto_dequeue_request(struct crypto_queue *queue) { struct list_head *request; if (unlikely(!queue->qlen)) return NULL; queue->qlen--; if (queue->backlog != &queue->list) queue->backlog = queue->backlog->next; request = queue->list.next; list_del(request); return list_entry(request, struct crypto_async_request, list); }
false
false
false
false
false
0
jmicron_suspend(struct sdhci_pci_chip *chip) { int i; if (chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB38X_MMC || chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB388_ESD) { for (i = 0; i < chip->num_slots; i++) jmicron_enable_mmc(chip->slots[i]->host, 0); } return 0; }
false
false
false
false
false
0
ipw_set_hw_decrypt_unicast(struct ipw_priv *priv, int level) { if (priv->ieee->host_encrypt) return; switch (level) { case SEC_LEVEL_3: priv->sys_config.disable_unicast_decryption = 0; priv->ieee->host_decrypt = 0; break; case SEC_LEVEL_2: priv->sys_config.disable_unicast_decryption = 1; priv->ieee->host_decrypt = 1; break; case SEC_LEVEL_1: priv->sys_config.disable_unicast_decryption = 0; priv->ieee->host_decrypt = 0; break; case SEC_LEVEL_0: priv->sys_config.disable_unicast_decryption = 1; break; default: break; } }
false
false
false
false
false
0
x_a_kill(KILL_NODE *node, ARTICLE *articles, SUBJECT *subj) { long n = 0; ARTICLE *art; for (art = articles ; art ; art = art->next) { if (art->xref && !art->read && art->pixmap == None && regexec(node->expr_re, art->xref, 0, NULL, 0) == 0) { art->read = True; art->killed = True; global.curr_group->no_unread--; art->subject->no_unread--; n++; } } return n; }
false
false
false
false
false
0
getCoordinate() const { if (isEmpty()) return NULL; return &(points->getAt(0)); }
false
false
false
false
false
0
CSTD() { ifstream in; in.open((Dir+"lgm_mix.txt").c_str(), ios::in); ReadVerify(in, true); if (in) in.close(); ofstream out((Dir+"lgm.txt").c_str()); WriteVerify(out); for (int n = 28; n >= 0; n -= 4) out << hex(seed, n); WriteVerify(out); out << endl; out.close(); }
false
false
false
false
false
0
mview0 (header *hd) { header *result; double *m; result=new_matrix(1,4,""); if (error) return; m=matrixof(result); *m++=distance; *m++=tele; *m++=a_left; *m=a_up; }
false
false
false
false
false
0
snd_usbmidi_detect_endpoints(struct snd_usb_midi *umidi, struct snd_usb_midi_endpoint_info *endpoint, int max_endpoints) { struct usb_interface *intf; struct usb_host_interface *hostif; struct usb_interface_descriptor *intfd; struct usb_endpoint_descriptor *epd; int i, out_eps = 0, in_eps = 0; if (USB_ID_VENDOR(umidi->usb_id) == 0x0582) snd_usbmidi_switch_roland_altsetting(umidi); if (endpoint[0].out_ep || endpoint[0].in_ep) return 0; intf = umidi->iface; if (!intf || intf->num_altsetting < 1) return -ENOENT; hostif = intf->cur_altsetting; intfd = get_iface_desc(hostif); for (i = 0; i < intfd->bNumEndpoints; ++i) { epd = get_endpoint(hostif, i); if (!usb_endpoint_xfer_bulk(epd) && !usb_endpoint_xfer_int(epd)) continue; if (out_eps < max_endpoints && usb_endpoint_dir_out(epd)) { endpoint[out_eps].out_ep = usb_endpoint_num(epd); if (usb_endpoint_xfer_int(epd)) endpoint[out_eps].out_interval = epd->bInterval; ++out_eps; } if (in_eps < max_endpoints && usb_endpoint_dir_in(epd)) { endpoint[in_eps].in_ep = usb_endpoint_num(epd); if (usb_endpoint_xfer_int(epd)) endpoint[in_eps].in_interval = epd->bInterval; ++in_eps; } } return (out_eps || in_eps) ? 0 : -ENOENT; }
false
false
false
false
false
0
sprite_draw(void) { int i; if (gameid == 0) // Wec Le Mans { sortsprite(spr_idx_list, spr_pri_list, spr_count); for (i=0; i<spr_count; i++) do_blit_zoom16(spr_ptr_list[spr_idx_list[i]]); } else // Hot Chase { for (i=0; i<spr_count; i++) do_blit_zoom16(spr_ptr_list[i]); } }
false
false
false
false
false
0
evalAsEnumerator(const Enum* target) { if (value_->container() != target) { char* vssn = value_->scopedName()->toString(); char* essn = target->scopedName()->toString(); IdlError(file(), line(), "Enumerator '%s' does not belong to enum '%s'", vssn, essn); delete [] essn; essn = value_->container()->scopedName()->toString(); IdlErrorCont(value_->file(), value_->line(), "(Enumerator '%s' declared in '%s' here)", vssn, essn); delete [] essn; delete [] vssn; } return value_; }
false
false
false
false
false
0
MapMemory (mem_obj_t *obj, Addr_t szb) { int fd; Addr_t addr, offset; #ifdef HAS_ANON_MMAP fd = -1; #else /* Note: we use O_RDONLY, because some OS are configured such that /dev/zero * is not writable. This works because we are using MAP_PRIVATE as the * mapping mode. */ if ((fd = open("/dev/zero", O_RDONLY)) == -1) { Error ("unable to open /dev/zero, errno = %d\n", errno); return FAILURE; } #endif /* we grab an extra BIBOP_PAGE_SZB bytes to give us some room for alignment */ addr = (Addr_t) mmap (MMAP_ADDR, szb+BIBOP_PAGE_SZB, PROT_ALL, MMAP_FLGS, fd, 0); if (addr == -1) { Error ("unable to map %d bytes, errno = %d\n", szb, errno); #ifndef HAS_ANON_MMAP close (fd); /* NOTE: this call clobbers errno */ #endif return FAILURE; } #ifndef HAS_ANON_MMAP close (fd); #endif /* insure BIBOP_PAGE_SZB alignment */ offset = BIBOP_PAGE_SZB - (addr & (BIBOP_PAGE_SZB-1)); #ifdef HAS_PARTIAL_MUNMAP if (offset != BIBOP_PAGE_SZB) { /* align addr and discard unused portions of memory */ munmap ((void *)addr, offset); addr += offset; munmap ((void *)(addr+szb), BIBOP_PAGE_SZB-offset); } else { munmap ((void *)(addr+szb), BIBOP_PAGE_SZB); } #else obj->mapBase = (Word_t *)addr; obj->mapSizeB = szb+BIBOP_PAGE_SZB; addr += offset; #endif obj->base = (Word_t *)addr; obj->sizeB = szb; return SUCCESS; }
false
false
false
false
true
1
gitg_commit_view_map (GtkWidget *widget) { GitgCommitView *self = GITG_COMMIT_VIEW (widget); GTK_WIDGET_CLASS (gitg_commit_view_parent_class)->map (widget); if (!self->priv->repository) { return; } initialize_commit (self); }
false
false
false
false
false
0
peerGetPinned(ps_state * ps) { request_t *request = ps->request; peer *peer; if (!request->pinned_connection) return; if (clientGetPinnedInfo(request->pinned_connection, request, &peer) != -1) { if (peer && peerAllowedToUse(peer, request)) { peerAddFwdServer(&ps->servers, peer, PINNED); if (ps->entry) ps->entry->ping_status = PING_DONE; /* Skip ICP */ } else if (!peer && ps->direct != DIRECT_NO) { peerAddFwdServer(&ps->servers, NULL, PINNED); if (ps->entry) ps->entry->ping_status = PING_DONE; /* Skip ICP */ } } }
false
false
false
false
false
0
update(const Path & path, const Revision & revision, bool recurse, bool ignore_externals) throw(ClientException) { Targets targets(path.c_str()); return update(targets, revision, recurse, ignore_externals)[0]; }
false
false
false
false
false
0
priestname(mon, pname) register struct monst *mon; char *pname; /* caller-supplied output buffer */ { const char *what = Hallucination ? rndmonnam() : mon->data->mname; Strcpy(pname, "the "); if (mon->minvis) Strcat(pname, "invisible "); if (mon->ispriest || mon->data == &mons[PM_ALIGNED_PRIEST] || mon->data == &mons[PM_ANGEL]) { /* use epri */ if (mon->mtame && mon->data == &mons[PM_ANGEL]) Strcat(pname, "guardian "); if (mon->data != &mons[PM_ALIGNED_PRIEST] && mon->data != &mons[PM_HIGH_PRIEST]) { Strcat(pname, what); Strcat(pname, " "); } if (mon->data != &mons[PM_ANGEL]) { if (!mon->ispriest && EPRI(mon)->renegade) Strcat(pname, "renegade "); if (mon->data == &mons[PM_HIGH_PRIEST]) Strcat(pname, "high "); if (Hallucination) Strcat(pname, "poohbah "); else if (mon->female) Strcat(pname, "priestess "); else Strcat(pname, "priest "); } Strcat(pname, "of "); Strcat(pname, halu_gname((int)EPRI(mon)->shralign)); return(pname); } /* use emin instead of epri */ Strcat(pname, what); Strcat(pname, " of "); Strcat(pname, halu_gname(EMIN(mon)->min_align)); return(pname); }
false
false
false
false
false
0
isCVTAToLocalCombinationCandidate(MachineInstr &Root) { auto &MBB = *Root.getParent(); auto &MF = *MBB.getParent(); // Check current instruction is cvta.to.local if (Root.getOpcode() != NVPTX::cvta_to_local_yes_64 && Root.getOpcode() != NVPTX::cvta_to_local_yes) return false; auto &Op = Root.getOperand(1); const auto &MRI = MF.getRegInfo(); MachineInstr *GenericAddrDef = nullptr; if (Op.isReg() && TargetRegisterInfo::isVirtualRegister(Op.getReg())) { GenericAddrDef = MRI.getUniqueVRegDef(Op.getReg()); } // Check the register operand is uniquely defined by LEA_ADDRi instruction if (!GenericAddrDef || GenericAddrDef->getParent() != &MBB || (GenericAddrDef->getOpcode() != NVPTX::LEA_ADDRi64 && GenericAddrDef->getOpcode() != NVPTX::LEA_ADDRi)) { return false; } // Check the LEA_ADDRi operand is Frame index auto &BaseAddrOp = GenericAddrDef->getOperand(1); if (BaseAddrOp.isReg() && BaseAddrOp.getReg() == NVPTX::VRFrame) { return true; } return false; }
false
false
false
false
false
0
appendReducedApostrophes(const UnicodeString &s, int32_t start, int32_t limit, UnicodeString &sb) { int32_t doubleApos=-1; for(;;) { int32_t i=s.indexOf(u_apos, start); if(i<0 || i>=limit) { sb.append(s, start, limit-start); break; } if(i==doubleApos) { // Double apostrophe at start-1 and start==i, append one. sb.append(u_apos); ++start; doubleApos=-1; } else { // Append text between apostrophes and skip this one. sb.append(s, start, i-start); doubleApos=start=i+1; } } }
false
false
false
false
false
0
stmmac_suspend(struct net_device *ndev) { struct stmmac_priv *priv = netdev_priv(ndev); unsigned long flags; if (!ndev || !netif_running(ndev)) return 0; if (priv->phydev) phy_stop(priv->phydev); spin_lock_irqsave(&priv->lock, flags); netif_device_detach(ndev); netif_stop_queue(ndev); napi_disable(&priv->napi); /* Stop TX/RX DMA */ priv->hw->dma->stop_tx(priv->ioaddr); priv->hw->dma->stop_rx(priv->ioaddr); /* Enable Power down mode by programming the PMT regs */ if (device_may_wakeup(priv->device)) { priv->hw->mac->pmt(priv->hw, priv->wolopts); priv->irq_wake = 1; } else { stmmac_set_mac(priv->ioaddr, false); pinctrl_pm_select_sleep_state(priv->device); /* Disable clock in case of PWM is off */ clk_disable(priv->pclk); clk_disable(priv->stmmac_clk); } spin_unlock_irqrestore(&priv->lock, flags); priv->oldlink = 0; priv->speed = 0; priv->oldduplex = -1; return 0; }
false
false
false
false
false
0
wm5110_in_analog_ev(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event) { struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); struct wm5110_priv *wm5110 = snd_soc_codec_get_drvdata(codec); struct arizona *arizona = priv->arizona; unsigned int reg, mask; struct reg_sequence analog_seq[] = { { 0x80, 0x3 }, { 0x35d, 0 }, { 0x80, 0x0 }, }; reg = ARIZONA_IN1L_CONTROL + ((w->shift ^ 0x1) * 4); mask = ARIZONA_IN1L_PGA_VOL_MASK; switch (event) { case SND_SOC_DAPM_WILL_PMU: wm5110->in_value |= 0x3 << ((w->shift ^ 0x1) * 2); wm5110->in_pre_pending++; wm5110->in_post_pending++; return 0; case SND_SOC_DAPM_PRE_PMU: wm5110->in_pga_cache[w->shift] = snd_soc_read(codec, reg); snd_soc_update_bits(codec, reg, mask, 0x40 << ARIZONA_IN1L_PGA_VOL_SHIFT); wm5110->in_pre_pending--; if (wm5110->in_pre_pending == 0) { analog_seq[1].def = wm5110->in_value; regmap_multi_reg_write_bypassed(arizona->regmap, analog_seq, ARRAY_SIZE(analog_seq)); msleep(55); wm5110->in_value = 0; } break; case SND_SOC_DAPM_POST_PMU: snd_soc_update_bits(codec, reg, mask, wm5110->in_pga_cache[w->shift]); wm5110->in_post_pending--; if (wm5110->in_post_pending == 0) regmap_multi_reg_write_bypassed(arizona->regmap, analog_seq, ARRAY_SIZE(analog_seq)); break; default: break; } return 0; }
false
false
false
false
false
0
__enqueue_in_driver(struct vb2_buffer *vb) { struct vb2_queue *q = vb->vb2_queue; unsigned int plane; vb->state = VB2_BUF_STATE_ACTIVE; atomic_inc(&q->owned_by_drv_count); trace_vb2_buf_queue(q, vb); /* sync buffers */ for (plane = 0; plane < vb->num_planes; ++plane) call_void_memop(vb, prepare, vb->planes[plane].mem_priv); call_void_vb_qop(vb, buf_queue, vb); }
false
false
false
false
false
0
motd(void) { int fd; fd = open(bb_path_motd_file, O_RDONLY); if (fd >= 0) { fflush_all(); bb_copyfd_eof(fd, STDOUT_FILENO); close(fd); } }
false
false
false
false
false
0
__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Huber___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_c = 0; int __pyx_r; double __pyx_t_1; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__c,0}; __Pyx_RefNannySetupContext("__init__"); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); PyObject* values[1] = {0}; switch (PyTuple_GET_SIZE(__pyx_args)) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__c); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_c = values[0]; } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { goto __pyx_L5_argtuple_error; } else { __pyx_v_c = PyTuple_GET_ITEM(__pyx_args, 0); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.Huber.__init__"); return -1; __pyx_L4_argument_unpacking_done:; /* "/home/mathieu/Desktop/projects/scikit-learn/sklearn/linear_model/sgd_fast.pyx":184 * * def __init__(self, c): * self.c = c # <<<<<<<<<<<<<< * * cpdef double loss(self, double p, double y): */ __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_c); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} ((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Huber *)__pyx_v_self)->c = __pyx_t_1; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.Huber.__init__"); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
false
false
false
false
false
0