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
iscsi_handle_chap_c_value ( struct iscsi_session *iscsi, const char *value ) { char buf[3]; char *endp; uint8_t byte; unsigned int i; /* Check and strip leading "0x" */ if ( ( value[0] != '0' ) || ( value[1] != 'x' ) ) { DBGC ( iscsi, "iSCSI %p saw invalid CHAP challenge \"%s\"\n", iscsi, value ); return -EPROTO; } value += 2; /* Process challenge an octet at a time */ for ( ; ( value[0] && value[1] ) ; value += 2 ) { memcpy ( buf, value, 2 ); buf[2] = 0; byte = strtoul ( buf, &endp, 16 ); if ( *endp != '\0' ) { DBGC ( iscsi, "iSCSI %p saw invalid CHAP challenge " "byte \"%s\"\n", iscsi, buf ); return -EPROTO; } chap_update ( &iscsi->chap, &byte, sizeof ( byte ) ); } /* Build CHAP response */ DBGC ( iscsi, "iSCSI %p sending CHAP response\n", iscsi ); chap_respond ( &iscsi->chap ); iscsi->status |= ISCSI_STATUS_STRINGS_CHAP_RESPONSE; /* Send CHAP challenge, if applicable */ if ( iscsi->target_username ) { iscsi->status |= ISCSI_STATUS_STRINGS_CHAP_CHALLENGE; /* Generate CHAP challenge data */ for ( i = 0 ; i < sizeof ( iscsi->chap_challenge ) ; i++ ) { iscsi->chap_challenge[i] = random(); } } return 0; }
true
true
false
false
true
1
identities_cleanup(void) { default_identity = NULL; if(!list_empty(&identities)) { struct list_head *ptr, *tmp; list_for_each_safe(ptr, tmp, &identities) { identity_t *identity; identity = list_entry(ptr, identity_t, list); list_del(ptr); identity_free(identity); } } }
false
false
false
false
false
0
ask_password_with_getpass (GSimpleAsyncResult *res, GObject *object, GCancellable *cancellable) { GTlsPassword *password; GError *error = NULL; password = g_simple_async_result_get_op_res_gpointer (res); console_interaction_ask_password (G_TLS_INTERACTION (object), password, cancellable, &error); if (error != NULL) g_simple_async_result_take_error (res, error); }
false
false
false
false
false
0
_buddy_alloc(unsigned order, uint32_t* seg, mca_memheap_buddy_heap_t *heap) { uint32_t o; uint32_t m; MEMHEAP_VERBOSE(20, "order=%d size=%d", order, 1<<order); OPAL_THREAD_LOCK(&memheap_buddy.lock); for (o = order; o <= heap->max_order; ++o) { if (heap->num_free[o]) { m = 1 << (heap->max_order - o); *seg = find_first_bit(heap->bits[o], m); MEMHEAP_VERBOSE(20, "found free bit: order=%d, bits=0x%lx m=%d, *seg=%d", o, heap->bits[o][0], m, *seg); if (*seg < m) goto found; } } OPAL_THREAD_UNLOCK(&memheap_buddy.lock); return OSHMEM_ERROR; found: clear_bit(*seg, heap->bits[o]); --(heap->num_free[o]); while (o > order) { --o; *seg <<= 1; set_bit(*seg ^ 1, heap->bits[o]); ++(heap->num_free[o]); } OPAL_THREAD_UNLOCK(&memheap_buddy.lock); *seg <<= order; return OSHMEM_SUCCESS; }
false
false
false
false
false
0
cxgb_netpoll(struct net_device *dev) { struct port_info *pi = netdev_priv(dev); struct adapter *adap = pi->adapter; if (adap->flags & USING_MSIX) { int i; struct sge_eth_rxq *rx = &adap->sge.ethrxq[pi->first_qset]; for (i = pi->nqsets; i; i--, rx++) t4_sge_intr_msix(0, &rx->rspq); } else t4_intr_handler(adap)(0, adap); }
false
false
false
false
false
0
parse_plugin_type (const gchar *option_name, const gchar *value, gpointer data, GError **error) { const char types[TOTEM_PLUGIN_TYPE_LAST][12] = { "gmp", "narrowspace", "mully", "cone", "vegas" }; TotemPluginType type; for (type = 0; type < TOTEM_PLUGIN_TYPE_LAST; ++type) { if (strcmp (value, types[type]) == 0) { arg_plugin_type = type; return TRUE; } } g_print ("Unknown plugin type '%s'\n", value); exit (1); }
true
true
false
false
false
1
test_simplewrite(void) { struct event ev; /* Very simple write test */ setup_test("Simple write: "); event_set(&ev, pair[0], EV_WRITE, simple_write_cb, &ev); if (event_add(&ev, NULL) == -1) exit(1); event_dispatch(); cleanup_test(); }
false
false
false
false
false
0
sample_process(struct proxy *px, struct session *l4, void *l7, unsigned int opt, struct sample_expr *expr, struct sample *p) { struct sample_conv_expr *conv_expr; if (p == NULL) { p = &temp_smp; memset(p, 0, sizeof(*p)); } if (!expr->fetch->process(px, l4, l7, opt, expr->arg_p, p, expr->fetch->kw)) return NULL; list_for_each_entry(conv_expr, &expr->conv_exprs, list) { /* we want to ensure that p->type can be casted into * conv_expr->conv->in_type. We have 3 possibilities : * - NULL => not castable. * - c_none => nothing to do (let's optimize it) * - other => apply cast and prepare to fail */ if (!sample_casts[p->type][conv_expr->conv->in_type]) return NULL; if (sample_casts[p->type][conv_expr->conv->in_type] != c_none && !sample_casts[p->type][conv_expr->conv->in_type](p)) return NULL; /* OK cast succeeded */ if (!conv_expr->conv->process(conv_expr->arg_p, p)) return NULL; } return p; }
false
false
false
false
false
0
list_object_tree(void) { int i; printf("obj par nxt chl Object tree:\n"); for (i=0; i<no_objects; i++) printf("%3d %3d %3d %3d\n", i+1,objectsz[i].parent,objectsz[i].next, objectsz[i].child); }
false
false
false
false
false
0
PrintSelf( std::ostream& os, Indent indent ) const { Superclass::PrintSelf( os, indent ); os<<indent<<"Create swarm using [normal, uniform] distribution: "; os<<"["<<this->m_InitializeNormalDistribution<<", "; os<<!this->m_InitializeNormalDistribution<<"]\n"; os<<indent<<"Number of particles in swarm: "<<this->m_NumberOfParticles<<"\n"; os<<indent<<"Maximal number of iterations: "<<this->m_MaximalNumberOfIterations<<"\n"; os<<indent<<"Number of generations with minimal improvement: "; os<<this->m_NumberOfGenerationsWithMinimalImprovement<<"\n"; ParameterBoundsType::const_iterator it, end; end = this->m_ParameterBounds.end(); os<<indent<<"Parameter bounds: ["; for( it=this->m_ParameterBounds.begin(); it != end; ++it ) os<<" ["<<(*it).first<<", "<<(*it).second<<"]"; os<<" ]\n"; os<<indent<<"Parameters' convergence tolerance: "<<this->m_ParametersConvergenceTolerance; os<<"\n"; os<<indent<<"Function convergence tolerance: "<<this->m_FunctionConvergenceTolerance << std::endl; os<<indent<<"UseSeed: " << m_UseSeed << std::endl; os<<indent<<"Seed: " << m_Seed << std::endl; os<<"\n"; //printing the swarm, usually should be avoided (too much information) if( this->m_PrintSwarm && !m_Particles.empty() ) { os<<indent<<"swarm data [current_parameters current_velocity current_value "; os<<"best_parameters best_value]:\n"; PrintSwarm( os, indent ); } }
false
false
false
false
false
0
Zseek(ZFILE *stream, long offset, int whence) { long newoffset; RUNTIMECHECK; if (ZS->errorencountered) return -1; CACHEUPDATE; if (whence == SEEK_SET) { newoffset = offset; } else if (whence == SEEK_CUR) { newoffset = ZS->fileposition + offset; } else if (whence == SEEK_END) { newoffset = ZS->fileposition + ZS->usiz; } else { return -1; } if ((newoffset < 0) || (newoffset > ZS->usiz)) return -1; ZS->fileposition = newoffset; return 0; }
false
false
false
false
false
0
reloc_name(unsigned long r_type) { static const char *r_name[] = { "R_X86_64_NONE", "R_X86_64_64", "R_X86_64_PC32", "R_X86_64_GOT32", "R_X86_64_PLT32", "R_X86_64_COPY", "R_X86_64_GLOB_DAT", "R_X86_64_JUMP_SLOT", "R_X86_64_RELATIVE", "R_X86_64_GOTPCREL", "R_X86_64_32", "R_X86_64_32S", "R_X86_64_16", "R_X86_64_PC16", "R_X86_64_8", "R_X86_64_PC8", "R_X86_64_DTPMOD64", "R_X86_64_DTPOFF64", "R_X86_64_TPOFF64", "R_X86_64_TLSGD", "R_X86_64_TLSLD", "R_X86_64_DTPOFF32", "R_X86_64_GOTTPOFF", "R_X86_64_TPOFF32", }; static char buf[100]; const char *name; if (r_type < (sizeof(r_name)/sizeof(r_name[0]))){ name = r_name[r_type]; } else { sprintf(buf, "R_X86_64_%lu", r_type); name = buf; } return name; }
false
false
false
false
false
0
PrintSelf(std::ostream & os, Indent indent) const { Superclass::PrintSelf(os, indent); os << indent << "Dimension: " << this->GetImageDimension() << std::endl; os << indent << "Index: "; for ( ImageIORegion::IndexType::const_iterator i = this->GetIndex().begin(); i != this->GetIndex().end(); ++i ) { os << *i << " "; } os << std::endl; os << indent << "Size: "; for ( ImageIORegion::SizeType::const_iterator k = this->GetSize().begin(); k != this->GetSize().end(); ++k ) { os << *k << " "; } os << std::endl; }
false
false
false
false
false
0
initUIEvent(const DOMString &typeArg, bool canBubbleArg, bool cancelableArg, AbstractViewImpl* viewArg, long detailArg) { EventImpl::initEvent(typeArg,canBubbleArg,cancelableArg); if (viewArg) viewArg->ref(); if (m_view) m_view->deref(); m_view = viewArg; m_detail = detailArg; }
false
false
false
false
false
0
flickcurl_build_tag_namespaces(flickcurl* fc, xmlXPathContextPtr xpathCtx, const xmlChar* xpathExpr, int* namespace_count_p) { flickcurl_tag_namespace** tag_namespaces = NULL; int nodes_count; int tag_namespace_count; int i; xmlXPathObjectPtr xpathObj = NULL; xmlNodeSetPtr nodes; /* Now do namespaces */ xpathObj = xmlXPathEvalExpression(xpathExpr, xpathCtx); if(!xpathObj) { flickcurl_error(fc, "Unable to evaluate XPath expression \"%s\"", xpathExpr); fc->failed = 1; goto tidy; } nodes = xpathObj->nodesetval; /* This is a max size - it can include nodes that are CDATA */ nodes_count = xmlXPathNodeSetGetLength(nodes); tag_namespaces = (flickcurl_tag_namespace**)calloc(sizeof(flickcurl_tag_namespace*), nodes_count + 1); for(i = 0, tag_namespace_count = 0; i < nodes_count; i++) { xmlNodePtr node = nodes->nodeTab[i]; xmlAttr* attr; flickcurl_tag_namespace* tn; xmlNodePtr chnode; if(node->type != XML_ELEMENT_NODE) { flickcurl_error(fc, "Got unexpected node type %d", node->type); fc->failed = 1; break; } tn = (flickcurl_tag_namespace*)calloc(sizeof(flickcurl_tag_namespace), 1); for(attr = node->properties; attr; attr = attr->next) { size_t attr_len = strlen((const char*)attr->children->content); const char *attr_name = (const char*)attr->name; char *attr_value; attr_value = (char*)malloc(attr_len + 1); memcpy(attr_value, (const char*)attr->children->content, attr_len + 1); if(!strcmp(attr_name, "usage")) { tn->usage_count = atoi(attr_value); free(attr_value); } else if(!strcmp(attr_name, "predicates")) { tn->predicates_count = atoi(attr_value); free(attr_value); } else free(attr_value); } /* Walk children for text */ for(chnode = node->children; chnode; chnode = chnode->next) { if(chnode->type == XML_TEXT_NODE) { size_t len = strlen((const char*)chnode->content); tn->name = (char*)malloc(len + 1); memcpy(tn->name, chnode->content, len + 1); } } #if FLICKCURL_DEBUG > 1 fprintf(stderr, "namespace: name %s usage %d predicates count %d\n", tn->name, tn->usage_count, tn->predicates_count); #endif tag_namespaces[tag_namespace_count++] = tn; } /* for nodes */ if(namespace_count_p) *namespace_count_p = tag_namespace_count; tidy: if(xpathObj) xmlXPathFreeObject(xpathObj); return tag_namespaces; }
false
true
true
false
true
1
validatePage() { if (name->text() != "") { DeviceConfigurations all; DeviceConfiguration add; // lets update 'here' with what we did then... add.type = wizard->type; add.name = name->text(); add.portSpec = port->text(); add.deviceProfile = profile->text(); add.defaultString = QString(defWatts->isChecked() ? "P" : "") + QString(defBPM->isChecked() ? "H" : "") + QString(defRPM->isChecked() ? "C" : "") + QString(defKPH->isChecked() ? "S" : ""); add.postProcess = virtualPower->currentIndex(); switch (wheelSize->currentIndex()) { default: case 0: add.wheelSize = 2100 ; break; case 1: add.wheelSize = 1960 ; break; case 2: add.wheelSize = 1985 ; break; case 3: add.wheelSize = 1750 ; break; } QList<DeviceConfiguration> list = all.getList(); list.insert(0, add); // call device add wizard. all.writeConfig(list); // tell everyone wizard->main->notifyConfigChanged(); // shut down the controller, if it is there, since it will // still be connected to the device (in case we hit the back button) if (wizard->controller) { wizard->controller->stop(); #ifdef WIN32 Sleep(1000); #else sleep(1); #endif delete wizard->controller; wizard->controller = NULL; } return true; } return false; }
false
false
false
false
false
0
xmlSchemaAddAnnotation(xmlSchemaAnnotItemPtr annItem, xmlSchemaAnnotPtr annot) { if ((annItem == NULL) || (annot == NULL)) return (NULL); switch (annItem->type) { case XML_SCHEMA_TYPE_ELEMENT: { xmlSchemaElementPtr item = (xmlSchemaElementPtr) annItem; ADD_ANNOTATION(annot) } break; case XML_SCHEMA_TYPE_ATTRIBUTE: { xmlSchemaAttributePtr item = (xmlSchemaAttributePtr) annItem; ADD_ANNOTATION(annot) } break; case XML_SCHEMA_TYPE_ANY_ATTRIBUTE: case XML_SCHEMA_TYPE_ANY: { xmlSchemaWildcardPtr item = (xmlSchemaWildcardPtr) annItem; ADD_ANNOTATION(annot) } break; case XML_SCHEMA_TYPE_PARTICLE: case XML_SCHEMA_TYPE_IDC_KEY: case XML_SCHEMA_TYPE_IDC_KEYREF: case XML_SCHEMA_TYPE_IDC_UNIQUE: { xmlSchemaAnnotItemPtr item = (xmlSchemaAnnotItemPtr) annItem; ADD_ANNOTATION(annot) } break; case XML_SCHEMA_TYPE_ATTRIBUTEGROUP: { xmlSchemaAttributeGroupPtr item = (xmlSchemaAttributeGroupPtr) annItem; ADD_ANNOTATION(annot) } break; case XML_SCHEMA_TYPE_NOTATION: { xmlSchemaNotationPtr item = (xmlSchemaNotationPtr) annItem; ADD_ANNOTATION(annot) } break; case XML_SCHEMA_FACET_MININCLUSIVE: case XML_SCHEMA_FACET_MINEXCLUSIVE: case XML_SCHEMA_FACET_MAXINCLUSIVE: case XML_SCHEMA_FACET_MAXEXCLUSIVE: case XML_SCHEMA_FACET_TOTALDIGITS: case XML_SCHEMA_FACET_FRACTIONDIGITS: case XML_SCHEMA_FACET_PATTERN: case XML_SCHEMA_FACET_ENUMERATION: case XML_SCHEMA_FACET_WHITESPACE: case XML_SCHEMA_FACET_LENGTH: case XML_SCHEMA_FACET_MAXLENGTH: case XML_SCHEMA_FACET_MINLENGTH: { xmlSchemaFacetPtr item = (xmlSchemaFacetPtr) annItem; ADD_ANNOTATION(annot) } break; case XML_SCHEMA_TYPE_SIMPLE: case XML_SCHEMA_TYPE_COMPLEX: { xmlSchemaTypePtr item = (xmlSchemaTypePtr) annItem; ADD_ANNOTATION(annot) } break; case XML_SCHEMA_TYPE_GROUP: { xmlSchemaModelGroupDefPtr item = (xmlSchemaModelGroupDefPtr) annItem; ADD_ANNOTATION(annot) } break; case XML_SCHEMA_TYPE_SEQUENCE: case XML_SCHEMA_TYPE_CHOICE: case XML_SCHEMA_TYPE_ALL: { xmlSchemaModelGroupPtr item = (xmlSchemaModelGroupPtr) annItem; ADD_ANNOTATION(annot) } break; default: xmlSchemaPCustomErr(NULL, XML_SCHEMAP_INTERNAL, NULL, NULL, "Internal error: xmlSchemaAddAnnotation, " "The item is not a annotated schema component", NULL); break; } return (annot); }
false
false
false
false
false
0
pyra_init_pyra_device_struct(struct usb_device *usb_dev, struct pyra_device *pyra) { struct pyra_settings settings; int retval, i; mutex_init(&pyra->pyra_lock); retval = pyra_get_settings(usb_dev, &settings); if (retval) return retval; for (i = 0; i < 5; ++i) { retval = pyra_get_profile_settings(usb_dev, &pyra->profile_settings[i], i); if (retval) return retval; } profile_activated(pyra, settings.startup_profile); return 0; }
false
false
false
false
false
0
IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader) { int end = Length(); int spaceFlags = 0; // Determines the indentation level of the current line and also checks for consistent // indentation compared to the previous line. // Indentation is judged consistent when the indentation whitespace of each line lines // the same or the indentation of one line is a prefix of the other. int pos = LineStart(line); char ch = (*this)[pos]; int indent = 0; bool inPrevPrefix = line > 0; int posPrev = inPrevPrefix ? LineStart(line-1) : 0; while ((ch == ' ' || ch == '\t') && (pos < end)) { if (inPrevPrefix) { char chPrev = (*this)[posPrev++]; if (chPrev == ' ' || chPrev == '\t') { if (chPrev != ch) spaceFlags |= wsInconsistent; } else { inPrevPrefix = false; } } if (ch == ' ') { spaceFlags |= wsSpace; indent++; } else { // Tab spaceFlags |= wsTab; if (spaceFlags & wsSpace) spaceFlags |= wsSpaceTab; indent = (indent / 8 + 1) * 8; } ch = (*this)[++pos]; } *flags = spaceFlags; indent += SC_FOLDLEVELBASE; // if completely empty line or the start of a comment... if ((LineStart(line) == Length()) || (ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r') || (pfnIsCommentLeader && (*pfnIsCommentLeader)(*this, pos, end-pos))) return indent | SC_FOLDLEVELWHITEFLAG; else return indent; }
false
false
false
false
false
0
gf_odf_size_ipmp_tool_list(GF_IPMP_ToolList *ipmptl, u32 *outSize) { if (!ipmptl) return GF_BAD_PARAM; *outSize = 0; return gf_odf_size_descriptor_list(ipmptl->ipmp_tools, outSize); }
false
false
false
false
false
0
formatHex( char * pszBuf, FLMBYTE ucChar) { FLMUINT uiNibble = ((FLMUINT)ucChar >> 4) & 0xF; *pszBuf++ = (char)(uiNibble <= 9 ? (char)(uiNibble + '0') : (char)(uiNibble - 10 + 'A')); uiNibble = (FLMUINT)ucChar & 0xF; *pszBuf = (char)(uiNibble <= 9 ? (char)(uiNibble + '0') : (char)(uiNibble - 10 + 'A')); }
false
false
false
false
false
0
modify_param(int narg, char **arg) { if (strcmp(arg[0],"unwrap") == 0) { if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); if (strcmp(arg[1],"yes") == 0) unwrap_flag = 1; else if (strcmp(arg[1],"no") == 0) unwrap_flag = 0; else error->all(FLERR,"Illegal dump_modify command"); return 2; } return 0; }
false
false
false
false
false
0
fcp_avc_transaction(struct fw_unit *unit, const void *command, unsigned int command_size, void *response, unsigned int response_size, unsigned int response_match_bytes) { struct fcp_transaction t; int tcode, ret, tries = 0; t.unit = unit; t.response_buffer = response; t.response_size = response_size; t.response_match_bytes = response_match_bytes; t.state = STATE_PENDING; init_waitqueue_head(&t.wait); if (*(const u8 *)command == 0x00 || *(const u8 *)command == 0x03) t.deferrable = true; spin_lock_irq(&transactions_lock); list_add_tail(&t.list, &transactions); spin_unlock_irq(&transactions_lock); for (;;) { tcode = command_size == 4 ? TCODE_WRITE_QUADLET_REQUEST : TCODE_WRITE_BLOCK_REQUEST; ret = snd_fw_transaction(t.unit, tcode, CSR_REGISTER_BASE + CSR_FCP_COMMAND, (void *)command, command_size, 0); if (ret < 0) break; deferred: wait_event_timeout(t.wait, t.state != STATE_PENDING, msecs_to_jiffies(FCP_TIMEOUT_MS)); if (t.state == STATE_DEFERRED) { /* * 'AV/C General Specification' define no time limit * on command completion once an INTERIM response has * been sent. but we promise to finish this function * for a caller. Here we use FCP_TIMEOUT_MS for next * interval. This is not in the specification. */ t.state = STATE_PENDING; goto deferred; } else if (t.state == STATE_COMPLETE) { ret = t.response_size; break; } else if (t.state == STATE_BUS_RESET) { msleep(ERROR_DELAY_MS); } else if (++tries >= ERROR_RETRIES) { dev_err(&t.unit->device, "FCP command timed out\n"); ret = -EIO; break; } } spin_lock_irq(&transactions_lock); list_del(&t.list); spin_unlock_irq(&transactions_lock); return ret; }
false
false
false
false
false
0
panel_background_set_type (PanelBackground *background, PanelBackgroundType type) { if (background->type == type) return; free_transformed_resources (background); background->type = type; panel_background_update_has_alpha (background); panel_background_transform (background); }
false
false
false
false
false
0
gupnp_service_info_get_introspection (GUPnPServiceInfo *info, GError **error) { GUPnPServiceIntrospection *introspection; SoupSession *session; SoupMessage *msg; int status; char *scpd_url; xmlDoc *scpd; g_return_val_if_fail (GUPNP_IS_SERVICE_INFO (info), NULL); introspection = NULL; scpd_url = gupnp_service_info_get_scpd_url (info); msg = NULL; if (scpd_url != NULL) { msg = soup_message_new (SOUP_METHOD_GET, scpd_url); g_free (scpd_url); } if (msg == NULL) { g_set_error (error, GUPNP_SERVER_ERROR, GUPNP_SERVER_ERROR_INVALID_URL, "No valid SCPD URL defined"); return NULL; } /* Send off the message */ session = gupnp_context_get_session (info->priv->context); status = soup_session_send_message (session, msg); if (!SOUP_STATUS_IS_SUCCESSFUL (status)) { _gupnp_error_set_server_error (error, msg); g_object_unref (msg); return NULL; } scpd = xmlRecoverMemory (msg->response_body->data, msg->response_body->length); g_object_unref (msg); if (scpd) { introspection = gupnp_service_introspection_new (scpd); xmlFreeDoc (scpd); } if (!introspection) { g_set_error (error, GUPNP_SERVER_ERROR, GUPNP_SERVER_ERROR_INVALID_RESPONSE, "Could not parse SCPD"); } return introspection; }
false
false
false
false
false
0
checkValidMain(const Expr& e2) { Theorem thm; QueryResult qres = checkValidRec(thm); if (qres == SATISFIABLE && d_core->incomplete()) qres = UNKNOWN; if (qres == SATISFIABLE) { DebugAssert(d_goal.get().getExpr().isTrue(), "checkValid: Expected true goal"); vector<Expr> a; d_goal.get().getLeafAssumptions(a); d_lastCounterExample.clear(); for (vector<Expr>::iterator i=a.begin(), iend=a.end(); i != iend; ++i) { d_lastCounterExample[*i] = true; } } else if (qres != UNSATISFIABLE) return qres; processResult(thm, e2); if (qres == UNSATISFIABLE) { TRACE_MSG("search terse", "checkValid => true}"); TRACE("search", "checkValid => true; theorem = ", d_lastValid, "}"); Theorem e_iff_e2(d_commonRules->iffContrapositive(d_simplifiedThm)); d_lastValid = d_commonRules->iffMP(d_lastValid, d_commonRules->symmetryRule(e_iff_e2)); d_core->getCM()->pop(); } else { TRACE_MSG("search terse", "checkValid => false}"); TRACE_MSG("search", "checkValid => false; }"); } return qres; }
false
false
false
false
false
0
lg4ff_deinit(struct hid_device *hid) { struct lg4ff_device_entry *entry; struct lg_drv_data *drv_data; drv_data = hid_get_drvdata(hid); if (!drv_data) { hid_err(hid, "Error while deinitializing device, no private driver data.\n"); return -1; } entry = drv_data->device_props; if (!entry) goto out; /* Nothing more to do */ /* Multimode devices will have at least the "MODE_NATIVE" bit set */ if (entry->wdata.alternate_modes) { device_remove_file(&hid->dev, &dev_attr_real_id); device_remove_file(&hid->dev, &dev_attr_alternate_modes); } device_remove_file(&hid->dev, &dev_attr_range); #ifdef CONFIG_LEDS_CLASS { int j; struct led_classdev *led; /* Deregister LEDs (if any) */ for (j = 0; j < 5; j++) { led = entry->wdata.led[j]; entry->wdata.led[j] = NULL; if (!led) continue; led_classdev_unregister(led); kfree(led); } } #endif hid_hw_stop(hid); drv_data->device_props = NULL; kfree(entry); out: dbg_hid("Device successfully unregistered\n"); return 0; }
false
false
false
false
false
0
Value() const { if (IsDeadCheck(i::Isolate::Current(), "v8::External::Value()")) return 0; i::Handle<i::Object> obj = Utils::OpenHandle(this); return ExternalValueImpl(obj); }
false
false
false
false
false
0
fetchUser(int user_id) { ostringstream userKey; userKey << user_id; return Users::fetchUser(userKey.str()); }
false
false
false
false
false
0
embDbiSortClose(AjPFile* elistfile, AjPFile* alistfile, ajuint nfields) { ajuint ifield; ajFileClose(elistfile); for(ifield=0; ifield < nfields; ifield++) ajFileClose(&alistfile[ifield]); return; }
false
false
false
false
false
0
fill_buffer(char *content, int fill, int size) { char *end = content + size; while (content < end) { if (fill > 0) { *content = FULL_CHAR; fill--; } else { *content = FREE_CHAR; } content++; } }
false
false
false
false
false
0
recurring_action_timer(gpointer data) { svc_action_t *op = data; crm_debug("Scheduling another invokation of %s", op->id); /* Clean out the old result */ free(op->stdout_data); op->stdout_data = NULL; free(op->stderr_data); op->stderr_data = NULL; services_action_async(op, NULL); return FALSE; }
false
false
false
false
false
0
spool_store_get_name (CamelService *service, gboolean brief) { CamelLocalSettings *local_settings; CamelSpoolStore *spool_store; CamelSettings *settings; gchar *name; gchar *path; spool_store = CAMEL_SPOOL_STORE (service); settings = camel_service_ref_settings (service); local_settings = CAMEL_LOCAL_SETTINGS (settings); path = camel_local_settings_dup_path (local_settings); g_object_unref (settings); if (brief) return path; switch (spool_store_get_type (spool_store, NULL)) { case CAMEL_SPOOL_STORE_MBOX: name = g_strdup_printf ( _("Spool mail file %s"), path); break; case CAMEL_SPOOL_STORE_ELM: name = g_strdup_printf ( _("Spool folder tree %s"), path); break; default: name = g_strdup (_("Invalid spool")); break; } g_free (path); return name; }
false
false
false
false
false
0
atkbd_set_scroll(struct atkbd *atkbd, const char *buf, size_t count) { struct input_dev *old_dev, *new_dev; unsigned int value; int err; bool old_scroll; err = kstrtouint(buf, 10, &value); if (err) return err; if (value > 1) return -EINVAL; if (atkbd->scroll != value) { old_dev = atkbd->dev; old_scroll = atkbd->scroll; new_dev = input_allocate_device(); if (!new_dev) return -ENOMEM; atkbd->dev = new_dev; atkbd->scroll = value; atkbd_set_keycode_table(atkbd); atkbd_set_device_attrs(atkbd); err = input_register_device(atkbd->dev); if (err) { input_free_device(new_dev); atkbd->scroll = old_scroll; atkbd->dev = old_dev; atkbd_set_keycode_table(atkbd); atkbd_set_device_attrs(atkbd); return err; } input_unregister_device(old_dev); } return count; }
false
false
false
false
false
0
bcm_sysport_set_coalesce(struct net_device *dev, struct ethtool_coalesce *ec) { struct bcm_sysport_priv *priv = netdev_priv(dev); unsigned int i; u32 reg; /* Base system clock is 125Mhz, DMA timeout is this reference clock * divided by 1024, which yield roughly 8.192 us, our maximum value has * to fit in the RING_TIMEOUT_MASK (16 bits). */ if (ec->tx_max_coalesced_frames > RING_INTR_THRESH_MASK || ec->tx_coalesce_usecs > (RING_TIMEOUT_MASK * 8) + 1 || ec->rx_max_coalesced_frames > RDMA_INTR_THRESH_MASK || ec->rx_coalesce_usecs > (RDMA_TIMEOUT_MASK * 8) + 1) return -EINVAL; if ((ec->tx_coalesce_usecs == 0 && ec->tx_max_coalesced_frames == 0) || (ec->rx_coalesce_usecs == 0 && ec->rx_max_coalesced_frames == 0)) return -EINVAL; for (i = 0; i < dev->num_tx_queues; i++) { reg = tdma_readl(priv, TDMA_DESC_RING_INTR_CONTROL(i)); reg &= ~(RING_INTR_THRESH_MASK | RING_TIMEOUT_MASK << RING_TIMEOUT_SHIFT); reg |= ec->tx_max_coalesced_frames; reg |= DIV_ROUND_UP(ec->tx_coalesce_usecs * 1000, 8192) << RING_TIMEOUT_SHIFT; tdma_writel(priv, reg, TDMA_DESC_RING_INTR_CONTROL(i)); } reg = rdma_readl(priv, RDMA_MBDONE_INTR); reg &= ~(RDMA_INTR_THRESH_MASK | RDMA_TIMEOUT_MASK << RDMA_TIMEOUT_SHIFT); reg |= ec->rx_max_coalesced_frames; reg |= DIV_ROUND_UP(ec->rx_coalesce_usecs * 1000, 8192) << RDMA_TIMEOUT_SHIFT; rdma_writel(priv, reg, RDMA_MBDONE_INTR); return 0; }
false
false
false
false
false
0
hash_insert (Hash_table *table, const void *entry) { void *data; struct hash_entry *bucket; /* The caller cannot insert a NULL entry. */ if (! entry) abort (); /* If there's a matching entry already in the table, return that. */ if ((data = hash_find_entry (table, entry, &bucket, false)) != NULL) return data; /* ENTRY is not matched, it should be inserted. */ if (bucket->data) { struct hash_entry *new_entry = allocate_entry (table); if (new_entry == NULL) return NULL; /* Add ENTRY in the overflow of the bucket. */ new_entry->data = (void *) entry; new_entry->next = bucket->next; bucket->next = new_entry; table->n_entries++; return (void *) entry; } /* Add ENTRY right in the bucket head. */ bucket->data = (void *) entry; table->n_entries++; table->n_buckets_used++; /* If the growth threshold of the buckets in use has been reached, increase the table size and rehash. There's no point in checking the number of entries: if the hashing function is ill-conditioned, rehashing is not likely to improve it. */ if (table->n_buckets_used > table->tuning->growth_threshold * table->n_buckets) { /* Check more fully, before starting real work. If tuning arguments became invalid, the second check will rely on proper defaults. */ check_tuning (table); if (table->n_buckets_used > table->tuning->growth_threshold * table->n_buckets) { const Hash_tuning *tuning = table->tuning; float candidate = (tuning->is_n_buckets ? (table->n_buckets * tuning->growth_factor) : (table->n_buckets * tuning->growth_factor * tuning->growth_threshold)); if (SIZE_MAX <= candidate) return NULL; /* If the rehash fails, arrange to return NULL. */ if (!hash_rehash (table, candidate)) entry = NULL; } } return (void *) entry; }
false
false
false
false
false
0
patch_stats(struct patch *patch) { int lines = patch->lines_added + patch->lines_deleted; if (lines > max_change) max_change = lines; if (patch->old_name) { int len = quote_c_style(patch->old_name, NULL, NULL, 0); if (!len) len = strlen(patch->old_name); if (len > max_len) max_len = len; } if (patch->new_name) { int len = quote_c_style(patch->new_name, NULL, NULL, 0); if (!len) len = strlen(patch->new_name); if (len > max_len) max_len = len; } }
false
false
false
false
false
0
RotationRueck( Point& X0, Matrix& R, double& mx, double& my, double& mz) { //Punkttransformation Matrix x(3,1,Null); x(0,0)=(*this).m_x; x(1,0)=(*this).m_y; x(2,0)=(*this).m_z; Matrix X0_(3,1,Null); X0_(0,0)=X0.m_x; X0_(1,0)=X0.m_y; X0_(2,0)=X0.m_z; Matrix X =x.MatSub(X0_); Matrix Ri=R.MatInvert().MatMult(X); Point PRt(Ri(0,0)*mx,Ri(1,0)*my,Ri(2,0)*mz); //Fehlertransformation Matrix dx(3,1,Null); dx(0,0)=(*this).get_dX(); dx(1,0)=(*this).get_dY(); dx(2,0)=(*this).get_dZ(); Matrix dX=R.MatInvert().MatMult(dx); PRt.set_dX(dX(0,0)*mx); PRt.set_dY(dX(1,0)*mx); PRt.set_dZ(dX(2,0)*mx); return PRt; }
false
false
false
false
false
0
startRendering() { glGenTextures(1, &m_realTextureObj); // this crashes sometimes!!!! (jmz) if(GLEW_VERSION_1_3) { glActiveTexture(GL_TEXTURE0_ARB + m_texunit); } glBindTexture(m_textureType, m_realTextureObj); m_textureObj=m_realTextureObj; setUpTextureState(); m_dataSize[0] = m_dataSize[1] = m_dataSize[2] = -1; if (!m_realTextureObj) { error("Unable to allocate texture object"); return; } }
false
false
false
false
false
0
parse_hex_byte (bmc_device_state_data_t *state_data, char *from, uint8_t *to, char *str) { char *endptr; int i; assert (state_data); assert (from); assert (to); assert (str); if (strlen (from) >= 2) { if (!strncmp (from, "0x", 2)) from += 2; } if (*from == '\0') { pstdout_fprintf (state_data->pstate, stderr, "invalid hex byte argument for %s\n", str); return (-1); } for (i = 0; from[i] != '\0'; i++) { if (i >= 2) { pstdout_fprintf (state_data->pstate, stderr, "invalid hex byte argument for %s\n", str); return (-1); } if (!isxdigit (from[i])) { pstdout_fprintf (state_data->pstate, stderr, "invalid hex byte argument for %s\n", str); return (-1); } } errno = 0; (*to) = strtol (from, &endptr, 16); if (errno || endptr[0] != '\0') { pstdout_fprintf (state_data->pstate, stderr, "invalid hex byte argument for %s\n", str); return (-1); } return (0); }
false
false
false
false
false
0
skin_load_group (GtkWidget * window) { static int loaded = 0; if (loaded) return; loaded = 1; GdkPixbuf *tmp_pixbuf; gchar skin_file[256]; sprintf (skin_file, "%s/group.png", Skin->dir); tmp_pixbuf = gdk_pixbuf_new_from_file (skin_file, NULL); skin_load_pixmap_1 (window, tmp_pixbuf, &(Skin->group.group)); g_object_unref (tmp_pixbuf); sprintf (skin_file, "%s/groupr.png", Skin->dir); tmp_pixbuf = gdk_pixbuf_new_from_file (skin_file, NULL); skin_load_pixmap_3 (window, tmp_pixbuf, &(Skin->group.ok_button)); skin_load_pixmap_3 (window, tmp_pixbuf, &(Skin->group.cancel_button)); skin_load_pixmap_3 (window, tmp_pixbuf, &(Skin->group.add_button)); skin_load_pixmap_3 (window, tmp_pixbuf, &(Skin->group.reduce_button)); skin_load_pixmap_3 (window, tmp_pixbuf, &(Skin->group.class_button)); skin_load_pixmap_3 (window, tmp_pixbuf, &(Skin->group.return_button)); skin_load_pixmap_4 (window, tmp_pixbuf, &(Skin->group.order_ckbutton)); g_object_unref (tmp_pixbuf); }
false
false
false
false
false
0
_del_FreeList(FreeList *fl, int force) { if(fl) { /* * Check whether any nodes are in use. */ if(!force && _busy_FreeListNodes(fl) != 0) { errno = EBUSY; return NULL; }; /* * Delete the list blocks. */ { FreeListBlock *next = fl->block; while(next) { FreeListBlock *block = next; next = block->next; block = _del_FreeListBlock(block); }; }; fl->block = NULL; fl->free_list = NULL; /* * Discard the container. */ free(fl); }; return NULL; }
false
false
false
false
false
0
X_productions(VOID) { switch(pp->cat) { case expr: { if(cat1==expr)SQUASH(pp,2,expr,0,5); else if(cat1==semi) { b_app1(pp); REDUCE(pp,2,stmt,-1,6); } } break; case stmt: { if(cat1==stmt) { b_app1(pp); b_app(force); b_app1(pp+1); REDUCE(pp,2,stmt,-1,250); } } break; } }
false
false
false
false
false
0
gretl_bundle_get_series (gretl_bundle *bundle, const char *key, int *n, int *err) { double *x = NULL; GretlType type; void *ptr; ptr = gretl_bundle_get_data(bundle, key, &type, n, err); if (!*err && type != GRETL_TYPE_SERIES) { *err = E_TYPES; } if (!*err) { x = (double *) ptr; } return x; }
false
false
false
false
false
0
Select() { vtkSelection* sel = 0; if (this->CaptureBuffers()) { sel = this->GenerateSelection(); this->ReleasePixBuffers(); } return sel; }
false
false
false
false
false
0
resize(int newLength) { char *s1 = s; if (!s || (roundedSize(length) != roundedSize(newLength))) { // requires re-allocating data for string if (newLength < STR_STATIC_SIZE) { s1 = sStatic; } else { // allocate a rounded amount if (s == sStatic) s1 = (char*)gmalloc(roundedSize(newLength)); else s1 = (char*)grealloc(s, roundedSize(newLength)); } if (s == sStatic || s1 == sStatic) { // copy the minimum, we only need to if are moving to or // from sStatic. // assert(s != s1) the roundedSize condition ensures this if (newLength < length) { memcpy(s1, s, newLength); } else { memcpy(s1, s, length); } } } s = s1; length = newLength; s[length] = '\0'; }
false
false
false
false
true
1
end_of_format (NODE_T * p, A68_REF ref_file) { /* Format-items return immediately to the embedding format text. The outermost format text calls "on format end". */ A68_FILE *file = FILE_DEREF (&ref_file); NODE_T *dollar = SUB (BODY (&FORMAT (file))); A68_FORMAT *save = (A68_FORMAT *) FRAME_LOCAL (frame_pointer, OFFSET (TAX (dollar))); if (IS_NIL_FORMAT (save)) { /* Not embedded, outermost format: execute event routine */ A68_BOOL z; on_event_handler (p, FORMAT_END_MENDED (FILE_DEREF (&ref_file)), ref_file); POP_OBJECT (p, &z, A68_BOOL); if (VALUE (&z) == A68_FALSE) { /* Restart format */ frame_pointer = FRAME_POINTER (file); stack_pointer = STACK_POINTER (file); open_format_frame (p, ref_file, &FORMAT (file), NOT_EMBEDDED_FORMAT, A68_TRUE); } return (NOT_EMBEDDED_FORMAT); } else { /* Embedded format, return to embedding format, cf. RR */ CLOSE_FRAME; FORMAT (file) = *save; return (EMBEDDED_FORMAT); } }
false
false
false
false
false
0
rhash_transmit(unsigned msg_id, void* dst, rhash_uptr_t ldata, rhash_uptr_t rdata) { rhash ctx = (rhash)dst; /* for messages working with rhash context */ switch(msg_id) { case RMSG_GET_CONTEXT: { unsigned i; for(i = 0; i < ctx->hash_vector_size; i++) { struct rhash_hash_info* info = ctx->vector[i].hash_info; if(info->info.hash_id == (unsigned)ldata) return PVOID2UPTR(ctx->vector[i].context); } return (rhash_uptr_t)0; } case RMSG_CANCEL: /* mark rhash context as canceled, in a multithreaded program */ atomic_compare_and_swap(&ctx->state, STATE_ACTIVE, STATE_STOPED); return 0; case RMSG_IS_CANCELED: return (ctx->state == STATE_STOPED); /* openssl related messages */ #ifdef USE_OPENSSL case RMSG_SET_OPENSSL_MASK: rhash_openssl_hash_mask = (unsigned)ldata; break; case RMSG_GET_OPENSSL_MASK: return rhash_openssl_hash_mask; #endif /* BitTorrent related messages */ case RMSG_BT_ADD_FILE: case RMSG_BT_SET_OPTIONS: case RMSG_BT_SET_ANNOUNCE: case RMSG_BT_SET_PIECE_LENGTH: case RMSG_BT_SET_PROGRAM_NAME: case RMSG_BT_GET_TEXT: return process_bt_msg(msg_id, (torrent_ctx*)(((rhash_context*)dst)->bt_ctx), ldata, rdata); default: return RHASH_ERROR; /* unknown message */ } return 0; }
false
false
false
false
false
0
multikey_qsort(StringPair **Begin, StringPair **End, int Pos) { tailcall: if (End - Begin <= 1) return; // Partition items. Items in [Begin, P) are greater than the pivot, // [P, Q) are the same as the pivot, and [Q, End) are less than the pivot. int Pivot = charTailAt(*Begin, Pos); StringPair **P = Begin; StringPair **Q = End; for (StringPair **R = Begin + 1; R < Q;) { int C = charTailAt(*R, Pos); if (C > Pivot) std::swap(*P++, *R++); else if (C < Pivot) std::swap(*--Q, *R); else R++; } multikey_qsort(Begin, P, Pos); multikey_qsort(Q, End, Pos); if (Pivot != -1) { // qsort(P, Q, Pos + 1), but with tail call optimization. Begin = P; End = Q; ++Pos; goto tailcall; } }
false
false
false
false
false
0
setConfigMinMax(eConfigFloatValues index, char const* fieldname, float defvalue, float minvalue, float maxvalue) { setConfig(index, fieldname, defvalue); if (getConfig(index) < minvalue) { sLog.outError("%s (%f) must be in range %f...%f. Using %f instead.", fieldname, getConfig(index), minvalue, maxvalue, minvalue); setConfig(index, minvalue); } else if (getConfig(index) > maxvalue) { sLog.outError("%s (%f) must be in range %f...%f. Using %f instead.", fieldname, getConfig(index), minvalue, maxvalue, maxvalue); setConfig(index, maxvalue); } }
false
false
false
false
false
0
checkValid(const Polygon *g) { checkInvalidCoordinates(g); if (validErr != NULL) return; checkClosedRings(g); if (validErr != NULL) return; GeometryGraph graph(0,g); checkTooFewPoints(&graph); if (validErr!=NULL) return; checkConsistentArea(&graph); if (validErr!=NULL) return; if (!isSelfTouchingRingFormingHoleValid) { checkNoSelfIntersectingRings(&graph); if (validErr!=NULL) return; } checkHolesInShell(g,&graph); if (validErr!=NULL) return; checkHolesNotNested(g,&graph); if (validErr!=NULL) return; checkConnectedInteriors(graph); }
false
false
false
false
false
0
cfi_staa_resume(struct mtd_info *mtd) { struct map_info *map = mtd->priv; struct cfi_private *cfi = map->fldrv_priv; int i; struct flchip *chip; for (i=0; i<cfi->numchips; i++) { chip = &cfi->chips[i]; mutex_lock(&chip->mutex); /* Go to known state. Chip may have been power cycled */ if (chip->state == FL_PM_SUSPENDED) { map_write(map, CMD(0xFF), 0); chip->state = FL_READY; wake_up(&chip->wq); } mutex_unlock(&chip->mutex); } }
false
false
false
false
false
0
ap_sta_info_defer_update(struct adapter *padapter, struct sta_info *psta) { if (psta->state & _FW_LINKED) { /* add ratid */ add_RATid(padapter, psta, 0);/* DM_RATR_STA_INIT */ } }
false
false
false
false
false
0
valleyview_check_pctx(struct drm_i915_private *dev_priv) { unsigned long pctx_addr = I915_READ(VLV_PCBR) & ~4095; WARN_ON(pctx_addr != dev_priv->mm.stolen_base + dev_priv->vlv_pctx->stolen->start); }
false
false
false
false
false
0
gst_rtp_vorbis_depay_parse_inband_configuration (GstRtpVorbisDepay * rtpvorbisdepay, guint ident, guint8 * configuration, guint size, guint length) { GstBuffer *confbuf; GstMapInfo map; if (G_UNLIKELY (size < 4)) return FALSE; /* transform inline to out-of-band and parse that one */ confbuf = gst_buffer_new_and_alloc (size + 9); gst_buffer_map (confbuf, &map, GST_MAP_WRITE); /* 1 header */ GST_WRITE_UINT32_BE (map.data, 1); /* write Ident */ GST_WRITE_UINT24_BE (map.data + 4, ident); /* write sort-of-length */ GST_WRITE_UINT16_BE (map.data + 7, length); /* copy remainder */ memcpy (map.data + 9, configuration, size); gst_buffer_unmap (confbuf, &map); return gst_rtp_vorbis_depay_parse_configuration (rtpvorbisdepay, confbuf); }
false
false
false
false
false
0
FDKaacEnc_getChannelAssignment(CHANNEL_MODE encMode, CHANNEL_ORDER co) { const CHANNEL_ASSIGNMENT_INFO_TAB *pTab; int i; if (co == CH_ORDER_MPEG) pTab = assignmentInfoTabMpeg; else if (co == CH_ORDER_WAV) pTab = assignmentInfoTabWav; else pTab = assignmentInfoTabWg4; for(i=MAX_MODES-1; i>0; i--) { if (encMode== pTab[i].encoderMode) { break; } } return (pTab[i].channel_assignment); }
false
false
false
false
false
0
FLAC__window_bartlett_hann(FLAC__real *window, const FLAC__int32 L) { const FLAC__int32 N = L - 1; FLAC__int32 n; for (n = 0; n < L; n++) window[n] = (FLAC__real)(0.62f - 0.48f * fabs((float)n/(float)N+0.5f) + 0.38f * cos(2.0f * M_PI * ((float)n/(float)N+0.5f))); }
false
false
false
false
false
0
dwc2_deactivate_qh(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh, int free_qtd) { int continue_split = 0; struct dwc2_qtd *qtd; if (dbg_qh(qh)) dev_vdbg(hsotg->dev, " %s(%p,%p,%d)\n", __func__, hsotg, qh, free_qtd); if (list_empty(&qh->qtd_list)) { dev_dbg(hsotg->dev, "## QTD list empty ##\n"); goto no_qtd; } qtd = list_first_entry(&qh->qtd_list, struct dwc2_qtd, qtd_list_entry); if (qtd->complete_split) continue_split = 1; else if (qtd->isoc_split_pos == DWC2_HCSPLT_XACTPOS_MID || qtd->isoc_split_pos == DWC2_HCSPLT_XACTPOS_END) continue_split = 1; if (free_qtd) { dwc2_hcd_qtd_unlink_and_free(hsotg, qtd, qh); continue_split = 0; } no_qtd: if (qh->channel) qh->channel->align_buf = 0; qh->channel = NULL; dwc2_hcd_qh_deactivate(hsotg, qh, continue_split); }
false
false
false
false
false
0
xMenu_Set (edict_t * ent) { int i; //setting title X_MENU->themenu[0].text = X_MENU->xmenuentries[0].name; X_MENU->themenu[0].align = PMENU_ALIGN_CENTER; X_MENU->themenu[1].text = NULL; X_MENU->themenu[1].align = PMENU_ALIGN_CENTER; X_MENU->themenu[2].text = X_MENU->xmenuentries[1].name; X_MENU->themenu[2].align = PMENU_ALIGN_CENTER; X_MENU->themenu[3].text = xRaw[5]; X_MENU->themenu[3].align = PMENU_ALIGN_CENTER; //setting bottom X_MENU->themenu[XMENU_END_ENTRY - 3].text = xRaw[5]; X_MENU->themenu[XMENU_END_ENTRY - 3].align = PMENU_ALIGN_CENTER; X_MENU->themenu[XMENU_END_ENTRY - 2].text = xRaw[3]; X_MENU->themenu[XMENU_END_ENTRY - 2].align = PMENU_ALIGN_CENTER; X_MENU->themenu[XMENU_END_ENTRY - 1].text = xRaw[4]; X_MENU->themenu[XMENU_END_ENTRY - 1].align = PMENU_ALIGN_CENTER; for (i = 2; i < X_MENU->xmenucount; i++) { X_MENU->themenu[i + 3].text = X_MENU->xmenuentries[i].name; X_MENU->themenu[i + 3].SelectFunc = X_MENU->xmenuentries[i].SelectFunc; } while (i < XMENU_TOTAL_ENTRIES) { X_MENU->themenu[i + 3].text = NULL; X_MENU->themenu[i + 3].SelectFunc = NULL; i++; } if (X_MENU->xmenucount == XMENU_TOTAL_ENTRIES) { //next must be enabled X_MENU->themenu[XMENU_END_ENTRY - 5].text = xRaw[2]; X_MENU->themenu[XMENU_END_ENTRY - 5].SelectFunc = xMenu_Next; } else { X_MENU->themenu[XMENU_END_ENTRY - 5].text = NULL; X_MENU->themenu[XMENU_END_ENTRY - 5].SelectFunc = NULL; } if (X_MENU->xmenutop) { //prev must be enabled X_MENU->themenu[XMENU_END_ENTRY - 6].text = xRaw[1]; X_MENU->themenu[XMENU_END_ENTRY - 6].SelectFunc = xMenu_Prev; } else { X_MENU->themenu[XMENU_END_ENTRY - 6].text = NULL; X_MENU->themenu[XMENU_END_ENTRY - 6].SelectFunc = NULL; } }
false
false
false
false
false
0
show_fontsel(GtkWidget *widget,gpointer *data){ const gchar *fontname=NULL; LOG(LOG_DEBUG, "IN : show_fontsel()"); font_no = (gint)(intptr_t)data; fontsel_dlg = gtk_font_selection_dialog_new("Please select font"); g_signal_connect(G_OBJECT (fontsel_dlg), "delete_event", G_CALLBACK(delete_fontsel), NULL); g_signal_connect(G_OBJECT(GTK_FONT_SELECTION_DIALOG (fontsel_dlg)->ok_button), "clicked", G_CALLBACK(ok_fontsel), NULL); g_signal_connect_swapped(G_OBJECT(GTK_FONT_SELECTION_DIALOG (fontsel_dlg)->cancel_button), "clicked", G_CALLBACK(gtk_widget_destroy), (gpointer)fontsel_dlg); gtk_widget_destroy(GTK_FONT_SELECTION_DIALOG (fontsel_dlg)->apply_button); switch(font_no){ case 0: fontname = gtk_entry_get_text(GTK_ENTRY(entry_normal)); break; case 1: fontname = gtk_entry_get_text(GTK_ENTRY(entry_bold)); break; case 2: fontname = gtk_entry_get_text(GTK_ENTRY(entry_italic)); break; case 3: fontname = gtk_entry_get_text(GTK_ENTRY(entry_super)); break; } gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(fontsel_dlg), fontname); gtk_widget_show_all(fontsel_dlg); gtk_grab_add(fontsel_dlg); LOG(LOG_DEBUG, "OUT : show_fontsel()"); }
false
false
false
false
false
0
jit_init (pTHX) { dSP; SV *load, *save; char *map_base; char *load_ptr, *save_ptr; STRLEN load_len, save_len, map_len; int count; eval_pv ("require 'Coro/jit-" CORO_JIT_TYPE ".pl'", 1); PUSHMARK (SP); #define VARx(name,expr,type) pushav_4uv (aTHX_ (UV)&(expr), sizeof (expr), offsetof (perl_slots, name), sizeof (type)); #include "state.h" count = call_pv ("Coro::State::_jit", G_ARRAY); SPAGAIN; save = POPs; save_ptr = SvPVbyte (save, save_len); load = POPs; load_ptr = SvPVbyte (load, load_len); map_len = load_len + save_len + 16; map_base = mmap (0, map_len, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); assert (("Coro: unable to mmap jit code page, cannot continue.", map_base != (char *)MAP_FAILED)); load_perl_slots = (load_save_perl_slots_type)map_base; memcpy (map_base, load_ptr, load_len); map_base += (load_len + 15) & ~15; save_perl_slots = (load_save_perl_slots_type)map_base; memcpy (map_base, save_ptr, save_len); /* we are good citizens and try to make the page read-only, so the evil evil */ /* hackers might have it a bit more difficult */ mprotect (map_base, map_len, PROT_READ | PROT_EXEC); PUTBACK; eval_pv ("undef &Coro::State::_jit", 1); }
false
false
false
false
false
0
map_madt_entry(int type, u32 acpi_id) { unsigned long madt_end, entry; phys_cpuid_t phys_id = PHYS_CPUID_INVALID; /* CPU hardware ID */ struct acpi_table_madt *madt; madt = get_madt_table(); if (!madt) return phys_id; entry = (unsigned long)madt; madt_end = entry + madt->header.length; /* Parse all entries looking for a match. */ entry += sizeof(struct acpi_table_madt); while (entry + sizeof(struct acpi_subtable_header) < madt_end) { struct acpi_subtable_header *header = (struct acpi_subtable_header *)entry; if (header->type == ACPI_MADT_TYPE_LOCAL_APIC) { if (!map_lapic_id(header, acpi_id, &phys_id)) break; } else if (header->type == ACPI_MADT_TYPE_LOCAL_X2APIC) { if (!map_x2apic_id(header, type, acpi_id, &phys_id)) break; } else if (header->type == ACPI_MADT_TYPE_LOCAL_SAPIC) { if (!map_lsapic_id(header, type, acpi_id, &phys_id)) break; } else if (header->type == ACPI_MADT_TYPE_GENERIC_INTERRUPT) { if (!map_gicc_mpidr(header, type, acpi_id, &phys_id)) break; } entry += header->length; } return phys_id; }
false
false
false
false
false
0
test_container_bitarray(void) { bitarray_t *ba = NULL; int i, j, ok=1; ba = bitarray_init_zero(1); test_assert(ba); test_assert(! bitarray_is_set(ba, 0)); bitarray_set(ba, 0); test_assert(bitarray_is_set(ba, 0)); bitarray_clear(ba, 0); test_assert(! bitarray_is_set(ba, 0)); bitarray_free(ba); ba = bitarray_init_zero(1023); for (i = 1; i < 64; ) { for (j = 0; j < 1023; ++j) { if (j % i) bitarray_set(ba, j); else bitarray_clear(ba, j); } for (j = 0; j < 1023; ++j) { if (!bool_eq(bitarray_is_set(ba, j), j%i)) ok = 0; } test_assert(ok); if (i < 7) ++i; else if (i == 28) i = 32; else i += 7; } done: if (ba) bitarray_free(ba); }
false
false
false
false
false
0
H5Pset_obj_track_times(hid_t plist_id, hbool_t track_times) { H5P_genplist_t *plist; /* Property list pointer */ uint8_t ohdr_flags; /* Object header flags */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(H5Pset_obj_track_times, FAIL) H5TRACE2("e", "ib", plist_id, track_times); /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Get object header flags */ if(H5P_get(plist, H5O_CRT_OHDR_FLAGS_NAME, &ohdr_flags) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get object header flags") /* Mask off previous time tracking flag settings */ ohdr_flags &= (uint8_t)~H5O_HDR_STORE_TIMES; /* Update with new time tracking flag */ ohdr_flags |= (uint8_t)(track_times ? H5O_HDR_STORE_TIMES : 0); /* Set object header flags */ if(H5P_set(plist, H5O_CRT_OHDR_FLAGS_NAME, &ohdr_flags) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set object header flags") done: FUNC_LEAVE_API(ret_value) }
false
false
false
false
false
0
win_kxkx(const board_t * board, int colour) { int me, opp; int att, def; int dist; int value; ASSERT(board!=NULL); ASSERT(colour==White||colour==Black); ASSERT(board->piece_nb==4); ASSERT(board->pawn_size[White]==0); ASSERT(board->pawn_size[Black]==0); // init me = colour; opp = COLOUR_OPP(me); att = KING_POS(board,me); def = KING_POS(board,opp); dist = DISTANCE(att,def); value = 0; // pst value += MajPst[SQUARE_TO_64(def)]; // king-king distance value += 80 - (dist * 10); // TODO: tune me! if (COLOUR_IS_BLACK(me)) value = -value; ASSERT(value!=0); ASSERT(value>-200&&value<200); return value; }
false
false
false
false
false
0
httpHeaderParseQuotedString(const char *start, String * val) { const char *end, *pos; stringClean(val); if (*start != '"') { debug(66, 2) ("failed to parse a quoted-string header field near '%s'\n", start); return 0; } pos = start + 1; while (*pos != '"') { int quoted = (*pos == '\\'); if (quoted) pos++; if (!*pos) { debug(66, 2) ("failed to parse a quoted-string header field near '%s'\n", start); stringClean(val); return 0; } end = pos + strcspn(pos + quoted, "\"\\") + quoted; stringAppend(val, pos, end - pos); pos = end; } /* Make sure it's defined even if empty "" */ if (!val->buf) stringLimitInit(val, "", 0); return 1; }
false
false
false
false
false
0
dgl_initialize_V2(dglGraph_s * pgraph) { if (pgraph->pNodeTree == NULL) pgraph->pNodeTree = avl_create(dglTreeNode2Compare, NULL, dglTreeGetAllocator()); if (pgraph->pNodeTree == NULL) { pgraph->iErrno = DGL_ERR_MemoryExhausted; return -pgraph->iErrno; } if (pgraph->pEdgeTree == NULL) pgraph->pEdgeTree = avl_create(dglTreeEdgeCompare, NULL, dglTreeGetAllocator()); if (pgraph->pEdgeTree == NULL) { pgraph->iErrno = DGL_ERR_MemoryExhausted; return -pgraph->iErrno; } return 0; }
false
false
false
false
false
0
get_signal_opts(char *optarg, uint16_t *warn_signal, uint16_t *warn_time, uint16_t *warn_flags) { char *endptr; long num; if (optarg == NULL) return -1; if (!strncasecmp(optarg, "B:", 2)) { *warn_flags = KILL_JOB_BATCH; optarg += 2; } endptr = strchr(optarg, '@'); if (endptr) endptr[0] = '\0'; num = (uint16_t) sig_name2num(optarg); if (endptr) endptr[0] = '@'; if ((num < 1) || (num > 0x0ffff)) return -1; *warn_signal = (uint16_t) num; if (!endptr) { *warn_time = 60; return 0; } num = strtol(endptr+1, &endptr, 10); if ((num < 0) || (num > 0x0ffff)) return -1; *warn_time = (uint16_t) num; if (endptr[0] == '\0') return 0; return -1; }
false
false
false
false
false
0
rk_tsadcv2_control(void __iomem *regs, bool enable) { u32 val; val = readl_relaxed(regs + TSADCV2_AUTO_CON); if (enable) val |= TSADCV2_AUTO_EN; else val &= ~TSADCV2_AUTO_EN; writel_relaxed(val, regs + TSADCV2_AUTO_CON); }
false
false
false
false
false
0
maybe_transfer_grabs (saver_screen_info *ssi, Window old_w, Window new_w, int new_screen_no) { saver_info *si = ssi->global; /* If the old window held our mouse grab, transfer the grab to the new window. (Grab the server while so doing, to avoid a race condition.) */ if (old_w == si->mouse_grab_window) { XGrabServer (si->dpy); /* ############ DANGER! */ ungrab_mouse (si); grab_mouse (si, ssi->screensaver_window, (si->demoing_p ? 0 : ssi->cursor), new_screen_no); XUngrabServer (si->dpy); XSync (si->dpy, False); /* ###### (danger over) */ } /* If the old window held our keyboard grab, transfer the grab to the new window. (Grab the server while so doing, to avoid a race condition.) */ if (old_w == si->keyboard_grab_window) { XGrabServer (si->dpy); /* ############ DANGER! */ ungrab_kbd(si); grab_kbd(si, ssi->screensaver_window, ssi->number); XUngrabServer (si->dpy); XSync (si->dpy, False); /* ###### (danger over) */ } }
false
false
false
false
false
0
r600_get_array_mode_alignment(struct array_mode_checker *values, u32 *pitch_align, u32 *height_align, u32 *depth_align, u64 *base_align) { u32 tile_width = 8; u32 tile_height = 8; u32 macro_tile_width = values->nbanks; u32 macro_tile_height = values->npipes; u32 tile_bytes = tile_width * tile_height * values->blocksize * values->nsamples; u32 macro_tile_bytes = macro_tile_width * macro_tile_height * tile_bytes; switch (values->array_mode) { case ARRAY_LINEAR_GENERAL: /* technically tile_width/_height for pitch/height */ *pitch_align = 1; /* tile_width */ *height_align = 1; /* tile_height */ *depth_align = 1; *base_align = 1; break; case ARRAY_LINEAR_ALIGNED: *pitch_align = max((u32)64, (u32)(values->group_size / values->blocksize)); *height_align = 1; *depth_align = 1; *base_align = values->group_size; break; case ARRAY_1D_TILED_THIN1: *pitch_align = max((u32)tile_width, (u32)(values->group_size / (tile_height * values->blocksize * values->nsamples))); *height_align = tile_height; *depth_align = 1; *base_align = values->group_size; break; case ARRAY_2D_TILED_THIN1: *pitch_align = max((u32)macro_tile_width * tile_width, (u32)((values->group_size * values->nbanks) / (values->blocksize * values->nsamples * tile_width))); *height_align = macro_tile_height * tile_height; *depth_align = 1; *base_align = max(macro_tile_bytes, (*pitch_align) * values->blocksize * (*height_align) * values->nsamples); break; default: return -EINVAL; } return 0; }
false
false
false
false
false
0
print_sinfo_reservation(reserve_info_msg_t *resv_ptr) { reserve_info_t *reserve_ptr = NULL; char format[64]; int i, width = 9; reserve_ptr = resv_ptr->reservation_array; if (!params.no_header) { for (i = 0; i < resv_ptr->record_count; i++) width = MAX(width, _resv_name_width(&reserve_ptr[i])); snprintf(format, sizeof(format), "%%-%ds %%8s %%19s %%19s %%11s %%s\n", width); printf(format, "RESV_NAME", "STATE", "START_TIME", "END_TIME", "DURATION", "NODELIST"); } for (i = 0; i < resv_ptr->record_count; i++) _print_reservation(&reserve_ptr[i], width); }
false
false
false
false
false
0
rot(double az, double inc) { normalize(); double th = acos(z); double ph = atan2(y, x); x = sin(th+inc)*cos(ph+az); y = sin(th+inc)*sin(ph+az); if(fabs(th+inc) > 0.01) z = cos(th+inc); normalize(); }
false
false
false
false
false
0
gli_delete_window(window_t *win) { window_t *prev, *next; if (gli_unregister_obj) (*gli_unregister_obj)(win, gidisp_Class_Window, win->disprock); win->magicnum = 0; win->echostr = NULL; if (win->str) { gli_delete_stream(win->str); win->str = NULL; } if (win->line_terminators) { free(win->line_terminators); win->line_terminators = NULL; } prev = win->prev; next = win->next; win->prev = NULL; win->next = NULL; if (prev) prev->next = next; else gli_windowlist = next; if (next) next->prev = prev; free(win); }
false
false
false
false
false
0
notify_complete(EventSelector *es, int fd, char *buf, int len, int flag, void *data) { Listener *l = (Listener *) data; l->write_ev = NULL; if (flag == EVENT_TCP_FLAG_TIMEOUT || flag == EVENT_TCP_FLAG_IOERROR) { close_listener(l); return; } if (l->msg[0]) { /* Queued message -- send it now */ notify(es, l, l->msg); l->msg[0] = 0; } }
false
false
false
false
false
0
alias_open(struct SRBRoot *bundle, const char *tag, UChar *value, int32_t len, const struct UString* comment, UErrorCode *status) { struct SResource *res = res_open(bundle, tag, comment, status); if (U_FAILURE(*status)) { return NULL; } res->fType = URES_ALIAS; if (len == 0 && gFormatVersion > 1) { res->u.fString.fChars = &gEmptyString; res->fRes = URES_MAKE_EMPTY_RESOURCE(URES_ALIAS); res->fWritten = TRUE; return res; } res->u.fString.fLength = len; res->u.fString.fChars = (UChar *) uprv_malloc(sizeof(UChar) * (len + 1)); if (res->u.fString.fChars == NULL) { *status = U_MEMORY_ALLOCATION_ERROR; uprv_free(res); return NULL; } uprv_memcpy(res->u.fString.fChars, value, sizeof(UChar) * (len + 1)); return res; }
false
false
false
false
false
0
nv_edit(cap) cmdarg_T *cap; { /* <Insert> is equal to "i" */ if (cap->cmdchar == K_INS || cap->cmdchar == K_KINS) cap->cmdchar = 'i'; #ifdef FEAT_VISUAL /* in Visual mode "A" and "I" are an operator */ if (VIsual_active && (cap->cmdchar == 'A' || cap->cmdchar == 'I')) v_visop(cap); /* in Visual mode and after an operator "a" and "i" are for text objects */ else #endif if ((cap->cmdchar == 'a' || cap->cmdchar == 'i') && (cap->oap->op_type != OP_NOP #ifdef FEAT_VISUAL || VIsual_active #endif )) { #ifdef FEAT_TEXTOBJ nv_object(cap); #else clearopbeep(cap->oap); #endif } else if (!curbuf->b_p_ma && !p_im) { /* Only give this error when 'insertmode' is off. */ EMSG(_(e_modifiable)); clearop(cap->oap); } else if (!checkclearopq(cap->oap)) { switch (cap->cmdchar) { case 'A': /* "A"ppend after the line */ curwin->w_set_curswant = TRUE; #ifdef FEAT_VIRTUALEDIT if (ve_flags == VE_ALL) { int save_State = State; /* Pretent Insert mode here to allow the cursor on the * character past the end of the line */ State = INSERT; coladvance((colnr_T)MAXCOL); State = save_State; } else #endif curwin->w_cursor.col += (colnr_T)STRLEN(ml_get_cursor()); break; case 'I': /* "I"nsert before the first non-blank */ if (vim_strchr(p_cpo, CPO_INSEND) == NULL) beginline(BL_WHITE); else beginline(BL_WHITE|BL_FIX); break; case 'a': /* "a"ppend is like "i"nsert on the next character. */ #ifdef FEAT_VIRTUALEDIT /* increment coladd when in virtual space, increment the * column otherwise, also to append after an unprintable char */ if (virtual_active() && (curwin->w_cursor.coladd > 0 || *ml_get_cursor() == NUL || *ml_get_cursor() == TAB)) curwin->w_cursor.coladd++; else #endif if (*ml_get_cursor() != NUL) inc_cursor(); break; } #ifdef FEAT_VIRTUALEDIT if (curwin->w_cursor.coladd && cap->cmdchar != 'A') { int save_State = State; /* Pretent Insert mode here to allow the cursor on the * character past the end of the line */ State = INSERT; coladvance(getviscol()); State = save_State; } #endif invoke_edit(cap, FALSE, cap->cmdchar, FALSE); } }
false
false
false
false
false
0
encode_ginst (MonoAotCompile *acfg, MonoGenericInst *inst, guint8 *buf, guint8 **endbuf) { guint8 *p = buf; int i; encode_value (inst->type_argc, p, &p); for (i = 0; i < inst->type_argc; ++i) encode_klass_ref (acfg, mono_class_from_mono_type (inst->type_argv [i]), p, &p); *endbuf = p; }
false
false
false
false
false
0
dump_symbols( void ) { #define SSYMBOL_SIZE 16 #define SYMBOLS_PER_BLOCK COD_BLOCK_SIZE/SSYMBOL_SIZE #define SR_LEN 0 #define SR_NAME 1 #define SR_TYPE 13 #define SR_VALUE 14 unsigned short i,j,start_block,end_block; char b[16]; start_block = gp_getu16(&directory_block_data[COD_DIR_SYMTAB]); if(start_block) { end_block = gp_getu16(&directory_block_data[COD_DIR_SYMTAB+2]); printf("\nSymbol Table Information\n"); printf("------------------------\n\n"); for(j=start_block; j<=end_block; j++) { read_block(temp, j); for(i=0; i<SYMBOLS_PER_BLOCK; i++) { if(temp[i*SSYMBOL_SIZE + SR_NAME]) printf("%s = %x, type = %s\n", substr(b, sizeof(b), &temp[i*SSYMBOL_SIZE + SR_NAME],12), gp_getu16(&temp[i*SSYMBOL_SIZE + SR_VALUE]), SymbolType4[(unsigned char)temp[i*SSYMBOL_SIZE + SR_TYPE]] ); } } } else printf("No symbol table info\n"); }
false
false
false
false
false
0
router_add_exit_policy(routerinfo_t *router, directory_token_t *tok) { addr_policy_t *newe; newe = router_parse_addr_policy(tok); if (!newe) return -1; if (! router->exit_policy) router->exit_policy = smartlist_new(); if (((tok->tp == K_ACCEPT6 || tok->tp == K_REJECT6) && tor_addr_family(&newe->addr) == AF_INET) || ((tok->tp == K_ACCEPT || tok->tp == K_REJECT) && tor_addr_family(&newe->addr) == AF_INET6)) { log_warn(LD_DIR, "Mismatch between field type and address type in exit " "policy"); addr_policy_free(newe); return -1; } smartlist_add(router->exit_policy, newe); return 0; }
false
false
false
false
false
0
gth_image_info_unref (GthImageInfo *image_info) { if (image_info == NULL) return; image_info->ref_count--; if (image_info->ref_count > 0) return; _g_object_unref (image_info->file_data); cairo_surface_destroy (image_info->image); cairo_surface_destroy (image_info->thumbnail_original); cairo_surface_destroy (image_info->thumbnail); cairo_surface_destroy (image_info->thumbnail_active); g_free (image_info->comment_text); g_free (image_info); }
false
false
false
false
false
0
free_object(struct alisp_object * p) { switch (alisp_get_type(p)) { case ALISP_OBJ_STRING: case ALISP_OBJ_IDENTIFIER: free(p->value.s); alisp_set_type(p, ALISP_OBJ_INTEGER); break; default: break; } }
false
false
false
false
false
0
reserv_sets_are_intersected (reserv_sets_t operand_1, reserv_sets_t operand_2) { set_el_t *el_ptr_1; set_el_t *el_ptr_2; set_el_t *cycle_ptr_1; set_el_t *cycle_ptr_2; if (operand_1 == NULL || operand_2 == NULL) abort (); for (el_ptr_1 = operand_1, el_ptr_2 = operand_2; el_ptr_1 < operand_1 + els_in_reservs; el_ptr_1++, el_ptr_2++) if (*el_ptr_1 & *el_ptr_2) return 1; reserv_sets_or (temp_reserv, operand_1, operand_2); for (cycle_ptr_1 = operand_1, cycle_ptr_2 = operand_2; cycle_ptr_1 < operand_1 + els_in_reservs; cycle_ptr_1 += els_in_cycle_reserv, cycle_ptr_2 += els_in_cycle_reserv) { for (el_ptr_1 = cycle_ptr_1, el_ptr_2 = get_excl_set (cycle_ptr_2); el_ptr_1 < cycle_ptr_1 + els_in_cycle_reserv; el_ptr_1++, el_ptr_2++) if (*el_ptr_1 & *el_ptr_2) return 1; if (!check_presence_pattern_sets (cycle_ptr_1, cycle_ptr_2, FALSE)) return 1; if (!check_presence_pattern_sets (temp_reserv + (cycle_ptr_2 - operand_2), cycle_ptr_2, TRUE)) return 1; if (!check_absence_pattern_sets (cycle_ptr_1, cycle_ptr_2, FALSE)) return 1; if (!check_absence_pattern_sets (temp_reserv + (cycle_ptr_2 - operand_2), cycle_ptr_2, TRUE)) return 1; } return 0; }
false
false
false
false
false
0
mark_obj(ScmObj obj) { #if SCM_USE_VECTOR scm_int_t i, len; ScmObj *vec; #endif mark_loop: /* no need to mark immediates */ if (SCM_IMMP(obj)) return; /* avoid cyclic marking */ if (SCM_MARKEDP(obj)) return; /* mark this object */ SCM_MARK(obj); /* mark recursively */ switch (SCM_PTAG(obj)) { case SCM_PTAG_CONS: /* CONS accessors bypass tag manipulation by default so we * have to do it specially here. */ obj = SCM_DROP_GCBIT(obj); mark_obj(SCM_CONS_CAR(obj)); obj = SCM_CONS_CDR(obj); goto mark_loop; case SCM_PTAG_CLOSURE: mark_obj(SCM_CLOSURE_EXP(obj)); obj = SCM_CLOSURE_ENV(obj); goto mark_loop; case SCM_PTAG_MISC: if (SYMBOLP(obj)) { obj = SCM_SYMBOL_VCELL(obj); goto mark_loop; #if SCM_USE_HYGIENIC_MACRO } else if (SCM_WRAPPERP(obj)) { /* Macro-related wrapper. */ obj = SCM_WRAPPER_OBJ(obj); goto mark_loop; #endif /* SCM_USE_HYGIENIC_MACRO */ #if SCM_USE_VECTOR /* Alert: objects that store a non-ScmObj in obj_x must * explicitly drop the GC bit here. This currently applies * only to vectors. */ } else if (VECTORP(obj)) { len = SCM_VECTOR_LEN(obj); vec = SCM_VECTOR_VEC(obj); vec = (ScmObj *)SCM_DROP_GCBIT((scm_intobj_t)vec); for (i = 0; i < len; i++) { mark_obj(vec[i]); } #endif /* SCM_USE_VECTOR */ } else if (VALUEPACKETP(obj)) { obj = SCM_VALUEPACKET_VALUES(obj); goto mark_loop; } break; default: break; } }
false
false
false
false
false
0
pairreplace(VALUE_PAIR **first, VALUE_PAIR *replace) { VALUE_PAIR *i, *next; VALUE_PAIR **prev = first; if (*first == NULL) { *first = replace; return; } /* * Not an empty list, so find item if it is there, and * replace it. Note, we always replace the first one, and * we ignore any others that might exist. */ for(i = *first; i; i = next) { next = i->next; /* * Found the first attribute, replace it, * and return. */ if ((i->attribute == replace->attribute) && (i->vendor == replace->vendor)) { *prev = replace; /* * Should really assert that replace->next == NULL */ replace->next = next; pairbasicfree(i); return; } /* * Point to where the attribute should go. */ prev = &i->next; } /* * If we got here, we didn't find anything to replace, so * stopped at the last item, which we just append to. */ *prev = replace; }
false
false
false
false
false
0
ddf_ColumnReduce(ddf_ConePtr cone) { ddf_colrange j,j1=0; ddf_rowrange i; ddf_boolean localdebug=ddf_FALSE; for (j=1;j<=cone->d;j++) { if (cone->InitialRayIndex[j]>0){ j1=j1+1; if (j1<j) { for (i=1; i<=cone->m; i++) ddf_set(cone->A[i-1][j1-1],cone->A[i-1][j-1]); cone->newcol[j]=j1; if (localdebug){ fprintf(stderr,"shifting the column %ld to column %ld\n", j, j1); } /* shifting forward */ } } else { cone->newcol[j]=0; if (localdebug) { fprintf(stderr,"a generator (or an equation) of the linearity space: "); for (i=1; i<=cone->d; i++) ddf_WriteNumber(stderr, cone->B[i-1][j-1]); fprintf(stderr,"\n"); } } } cone->d=j1; /* update the dimension. cone->d_orig remembers the old. */ ddf_CopyBmatrix(cone->d_orig, cone->B, cone->Bsave); /* save the dual basis inverse as Bsave. This matrix contains the linearity space generators. */ cone->ColReduced=ddf_TRUE; }
false
false
false
false
false
0
iwl_mvm_scan_uid_by_status(struct iwl_mvm *mvm, int status) { int i; for (i = 0; i < mvm->max_scans; i++) if (mvm->scan_uid_status[i] == status) return i; return -ENOENT; }
false
false
false
false
false
0
dualhash_new(hash_fn_t khash, eq_fn_t keq, hash_fn_t vhash, eq_fn_t veq) { dualhash_t *dh; if (NULL == khash) khash = pointer_hash; if (NULL == vhash) vhash = pointer_hash; WALLOC(dh); dh->magic = DUALHASH_MAGIC; dh->kht = htable_create_any(khash, NULL, keq); dh->vht = htable_create_any(vhash, NULL, veq); dh->key_eq_func = keq; dh->val_eq_func = veq; return dh; }
false
false
false
false
false
0
sinfo_parse_cpl_input_ns(cpl_parameterlist * cpl_cfg, cpl_frameset* sof, cpl_frameset** raw) { ns_config * cfg = sinfo_ns_cfg_create(); int status=0; /* * Perform sanity checks, fill up the structure with what was * found in the ini file */ parse_section_cleanmean (cfg,cpl_cfg); parse_section_gaussconvolution (cfg,cpl_cfg); parse_section_northsouthtest (cfg,cpl_cfg); parse_section_frames (cfg,cpl_cfg,sof,raw,&status); if (status > 0) { sinfo_msg_error("parsing cpl input"); sinfo_ns_cfg_destroy(cfg); cfg = NULL ; return NULL ; } return cfg ; }
false
false
false
false
false
0
Lstring_eq() { # line 267 "string.d" int s1=0, e1=0, s2=0, e2=0; int narg; register object *DPPbase=vs_base; #define string1 DPPbase[0] #define string2 DPPbase[1] #define start1 DPPbase[2+0+0] #define end1 DPPbase[2+0+1] #define start2 DPPbase[2+0+2] #define end2 DPPbase[2+0+3] narg = vs_top - vs_base; if (narg < 2) too_few_arguments(); parse_key(vs_base+2+0,FALSE, FALSE, 4, sKstart1, sKend1, sKstart2, sKend2); vs_top = vs_base + 2+0+2*4; # line 269 "string.d" string1 = coerce_to_string(string1); string2 = coerce_to_string(string2); get_string_start_end(string1, start1, end1, &s1, &e1); get_string_start_end(string2, start2, end2, &s2, &e2); if (e1 - s1 != e2 - s2) { vs_base[0] = Cnil; vs_top = vs_base + 1; return; } # line 275 "string.d" while (s1 < e1) if (string1->st.st_self[s1++] != string2->st.st_self[s2++]) { vs_base[0] = Cnil; vs_top = vs_base + 1; return; } # line 279 "string.d" { vs_base[0] = Ct; vs_top = vs_base + 1; return; } # line 280 "string.d" #undef string1 #undef string2 #undef start1 #undef end1 #undef start2 #undef end2 }
false
false
false
false
false
0
alloca_call_p (const_tree exp) { if (TREE_CODE (exp) == CALL_EXPR && TREE_CODE (CALL_EXPR_FN (exp)) == ADDR_EXPR && (TREE_CODE (TREE_OPERAND (CALL_EXPR_FN (exp), 0)) == FUNCTION_DECL) && (special_function_p (TREE_OPERAND (CALL_EXPR_FN (exp), 0), 0) & ECF_MAY_BE_ALLOCA)) return true; return false; }
false
false
false
false
true
1
print_renames(struct fnode *x)/*{{{*/ { struct fnode *e; for (e = x->next; e != x; e = e->next) { if (e->is_dir) { print_renames(dir_children(e)); } else { if (is_rename_file(e)) { printf("R %s->%s\n", e->path, e->x.file.content_peer->path); } } } }
false
false
false
false
false
0
property_factory (ccss_grammar_t const *grammar, ccss_block_t *block, char const *name, CRTerm const *values, void *user_data) { ccss_gtk_property_t s, *self; g_return_val_if_fail (grammar, false); g_return_val_if_fail (block, false); g_return_val_if_fail (name, false); g_return_val_if_fail (values, false); /* PONDERING: Handle things like GtkSettings `gtk-button-images' in the future? */ memset (&s, 0, sizeof (s)); ccss_property_init (&s.base, peek_property_class ()); self = NULL; if (0 == g_strcmp0 (name, "xthickness")) { if (parse_gint (values, &s)) { s.class_name = NULL; s.property_name = g_strdup ("xthickness"); self = g_new0 (ccss_gtk_property_t, 1); *self = s; ccss_block_add_property (block, "xthickness", &self->base); } return (bool) self; } else if (0 == g_strcmp0 (name, "ythickness")) { if (parse_gint (values, &s)) { s.class_name = NULL; s.property_name = g_strdup ("ythickness"); self = g_new0 (ccss_gtk_property_t, 1); *self = s; ccss_block_add_property (block, "ythickness", &self->base); } return (bool) self; } else if (g_str_has_prefix (name, "Gtk")) { if (parse_gtk_style_property (grammar, name, values, user_data, &s)) { self = g_new0 (ccss_gtk_property_t, 1); *self = s; ccss_block_add_property (block, name, &self->base); } return (bool) self; } else if (g_ascii_isupper (name[0])) { // FIXME introspect style property and feed back to gtk directly. // Non-gtk style properties (wnck, nautilus, ...) can't be // resolved offline because css2gtkrc doesn't link against them. // May cause some breakage, let's see how it goes. } /* Fall back. */ g_return_val_if_fail (_fallback_property_class, false); g_return_val_if_fail (_fallback_property_class->factory, false); return _fallback_property_class->factory (grammar, block, name, values, user_data); }
false
false
false
false
false
0
removeDictRef(EnchantDict *dict) { int refs = m_dictRefs[dict]; --refs; m_dictRefs[dict] = refs; if (refs <= 0) { m_dictRefs.remove(dict); enchant_broker_free_dict(m_broker, dict); } }
false
false
false
false
false
0
fr_perror(const char *fmt, ...) { va_list ap; va_start(ap, fmt); vfprintf(stderr, fmt, ap); if (strchr(fmt, ':') == NULL) fprintf(stderr, ": "); fprintf(stderr, "%s\n", fr_strerror()); va_end(ap); }
false
false
false
false
true
1
convert_string_list (const iconveh_t *cd, string_list_ty *slp, const struct conversion_context* context) { size_t i; if (slp != NULL) for (i = 0; i < slp->nitems; i++) slp->item[i] = convert_string (cd, slp->item[i], context); }
false
false
false
false
false
0
isTiffType(BasicIo& iIo, bool advance) { const int32_t len = 8; byte buf[len]; iIo.read(buf, len); if (iIo.error() || iIo.eof()) { return false; } TiffHeader tiffHeader; bool rc = tiffHeader.read(buf, len); if (!advance || !rc) { iIo.seek(-len, BasicIo::cur); } return rc; } }
false
false
false
false
false
0
get_1pe_iteration_from_pestm(Pe_statement *pe_stm) { int k, n; Quadruple *do_qr; SemTree *i[3]; do_qr = search_do_qr_from_pe_stm(pe_stm); for (k = 0; k < 3; k++) i[k] = make_semtree_operand(pe_stm->block->module, do_qr->op[k+1], do_qr); /* n = (i[1] - i[0]) / i[2] + 1; */ n = calculate_routation_from_semtree(i); for (k = 0; k < 3; k++) semtree_destruct(i[k]); return n; }
false
false
false
false
false
0
skip_forwardCmd(int n) { Require(n >= 0, err("Require positive (or zero) number of lines to skip")); if (_dataFILE.back().get_type() == DataFile::from_cmdfile) { warning("Cannot `skip' when data are embedded in command-file"); return true; } while (n-- > 0) { if (_dataFILE.back().get_type() != DataFile::ascii) { // type=0 ascii, others binary unsigned char tmpB; if (1 != fread((char *) & tmpB, sizeof(tmpB), 1, _dataFILE.back().get_fp())) { warning("I/O error while skip forward in binary file."); return false; } if (feof(_dataFILE.back().get_fp())) { set_eof_flag_on_data_file(); warning("`skip forward' at end-of-file on file `\\", _dataFILE.back().get_name(), "'", "\\"); break; } } else { // Ascii file GriString inLine(128); // Start short if (inLine.line_from_FILE(_dataFILE.back().get_fp())) { set_eof_flag_on_data_file(); warning("`skip forward' at end-of-file on file `\\", _dataFILE.back().get_name(), "'", "\\"); return true; } _dataFILE.back().increment_line(); } } return true; }
false
false
false
false
false
0
vblast() { if (prop[ROD2] < 0 || !closed) actspk(verb); else { bonus = 133; if (loc == 115) bonus = 134; if (here(ROD2)) bonus = 135; rspeak(bonus); normend(); } }
false
false
false
false
false
0