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 |
|---|---|---|---|---|---|---|
consolidateRules()
{
typedef vector<ExtractedRule>::iterator R;
map<int, map<int, map<int, map<int,int> > > > spanCount;
// compute number of rules per span
if (m_options.fractionalCounting) {
for(R rule = m_extractedRules.begin(); rule != m_extractedRules.end(); rule++ ) {
spanCount[ rule->startT ][ rule->endT ][ rule->startS ][ rule->endS ]++;
}
}
// compute fractional counts
for(R rule = m_extractedRules.begin(); rule != m_extractedRules.end(); rule++ ) {
rule->count = (float)1.0/(float) (m_options.fractionalCounting ? spanCount[ rule->startT ][ rule->endT ][ rule->startS ][ rule->endS ] : 1.0 );
}
// consolidate counts
map<std::string, map< std::string, map< std::string, float> > > consolidatedCount;
for(R rule = m_extractedRules.begin(); rule != m_extractedRules.end(); rule++ ) {
consolidatedCount[ rule->source ][ rule->target][ rule->alignment ] += rule->count;
}
for(R rule = m_extractedRules.begin(); rule != m_extractedRules.end(); rule++ ) {
float count = consolidatedCount[ rule->source ][ rule->target][ rule->alignment ];
rule->count = count;
consolidatedCount[ rule->source ][ rule->target][ rule->alignment ] = 0;
}
} | false | false | false | false | false | 0 |
afr_mark_child_as_source_by_uid (int32_t *sources, struct iatt *bufs,
int32_t *valid_children, int child_count,
uint32_t uid)
{
int i = 0;
int nsources = 0;
int child = 0;
GF_ASSERT (bufs);
GF_ASSERT (valid_children);
GF_ASSERT (sources);
GF_ASSERT (child_count > 0);
for (i = 0; i < child_count; i++) {
if (-1 == valid_children[i])
continue;
child = valid_children[i];
if (uid == bufs[child].ia_uid) {
sources[child] = 1;
nsources++;
}
}
return nsources;
} | false | false | false | true | false | 1 |
Deinit() {
if (state_ == INITIALIZED) {
TRACE_ISOLATE(deinit);
if (FLAG_hydrogen_stats) HStatistics::Instance()->Print();
// We must stop the logger before we tear down other components.
logger_->EnsureTickerStopped();
delete deoptimizer_data_;
deoptimizer_data_ = NULL;
if (FLAG_preemption) {
v8::Locker locker;
v8::Locker::StopPreemption();
}
builtins_.TearDown();
bootstrapper_->TearDown();
// Remove the external reference to the preallocated stack memory.
delete preallocated_message_space_;
preallocated_message_space_ = NULL;
PreallocatedMemoryThreadStop();
HeapProfiler::TearDown();
CpuProfiler::TearDown();
if (runtime_profiler_ != NULL) {
runtime_profiler_->TearDown();
delete runtime_profiler_;
runtime_profiler_ = NULL;
}
heap_.TearDown();
logger_->TearDown();
// The default isolate is re-initializable due to legacy API.
state_ = UNINITIALIZED;
}
} | false | false | false | false | false | 0 |
print_pseudo_costs (FILE *f)
{
int regno, k;
int rclass;
cost_classes_t cost_classes_ptr;
enum reg_class *cost_classes;
ira_assert (! allocno_p);
fprintf (f, "\n");
for (regno = max_reg_num () - 1; regno >= FIRST_PSEUDO_REGISTER; regno--)
{
if (REG_N_REFS (regno) <= 0)
continue;
cost_classes_ptr = regno_cost_classes[regno];
cost_classes = cost_classes_ptr->classes;
fprintf (f, " r%d costs:", regno);
for (k = 0; k < cost_classes_ptr->num; k++)
{
rclass = cost_classes[k];
if (contains_reg_of_mode[rclass][PSEUDO_REGNO_MODE (regno)]
#ifdef CANNOT_CHANGE_MODE_CLASS
&& ! invalid_mode_change_p (regno, (enum reg_class) rclass)
#endif
)
fprintf (f, " %s:%d", reg_class_names[rclass],
COSTS (costs, regno)->cost[k]);
}
fprintf (f, " MEM:%i\n", COSTS (costs, regno)->mem_cost);
}
} | false | false | false | false | false | 0 |
_gen_job_prio(struct job_record *job_ptr)
{
uint32_t job_prio;
slurmdb_qos_rec_t *qos_ptr = job_ptr->qos_ptr;
if (qos_ptr)
job_prio = (qos_ptr->priority & 0xffff) << 16;
else
job_prio = 0;
if (job_ptr->node_cnt >= 0xffff)
job_prio += 0xffff;
else
job_prio += job_ptr->node_cnt;
return job_prio;
} | false | false | false | false | false | 0 |
authenticate_cb (SoupSession *session, SoupMessage *msg, SoupAuth *auth, gboolean retrying, DMAPConnection *connection)
{
if (retrying || ! connection->priv->password) {
g_debug ("Requesting password from application");
soup_session_pause_message (session, msg);
// FIXME: GDK_THREADS_ENTER ();
g_signal_emit (connection,
signals[AUTHENTICATE],
0,
connection->priv->name,
session,
msg,
auth,
retrying);
// FIXME: GDK_THREADS_LEAVE ();
} else {
g_debug ("Using cached credentials");
soup_auth_authenticate (auth, connection->priv->username, connection->priv->password);
}
} | false | false | false | false | false | 0 |
via_mem_free(struct drm_device *dev, void *data, struct drm_file *file_priv)
{
drm_via_private_t *dev_priv = dev->dev_private;
drm_via_mem_t *mem = data;
struct via_memblock *obj;
mutex_lock(&dev->struct_mutex);
obj = idr_find(&dev_priv->object_idr, mem->index);
if (obj == NULL) {
mutex_unlock(&dev->struct_mutex);
return -EINVAL;
}
idr_remove(&dev_priv->object_idr, mem->index);
list_del(&obj->owner_list);
drm_mm_remove_node(&obj->mm_node);
kfree(obj);
mutex_unlock(&dev->struct_mutex);
DRM_DEBUG("free = 0x%lx\n", mem->index);
return 0;
} | false | false | false | false | false | 0 |
_g_time_val_from_exif_date (const char *exif_date,
GTimeVal *time_)
{
struct tm tm;
long val;
g_return_val_if_fail (time_ != NULL, FALSE);
if (exif_date == NULL)
return FALSE;
while (g_ascii_isspace (*exif_date))
exif_date++;
if (*exif_date == '\0')
return FALSE;
if (! g_ascii_isdigit (*exif_date))
return FALSE;
tm.tm_isdst = -1;
/* YYYY */
val = g_ascii_strtoull (exif_date, (char **)&exif_date, 10);
tm.tm_year = val - 1900;
if (*exif_date != ':')
return FALSE;
/* MM */
exif_date++;
tm.tm_mon = g_ascii_strtoull (exif_date, (char **)&exif_date, 10) - 1;
if (*exif_date != ':')
return FALSE;
/* DD */
exif_date++;
tm.tm_mday = g_ascii_strtoull (exif_date, (char **)&exif_date, 10);
if (*exif_date != ' ')
return FALSE;
/* hh */
val = g_ascii_strtoull (exif_date, (char **)&exif_date, 10);
tm.tm_hour = val;
if (*exif_date != ':')
return FALSE;
/* mm */
exif_date++;
tm.tm_min = g_ascii_strtoull (exif_date, (char **)&exif_date, 10);
if (*exif_date != ':')
return FALSE;
/* ss */
exif_date++;
tm.tm_sec = strtoul (exif_date, (char **)&exif_date, 10);
time_->tv_sec = mktime (&tm);
time_->tv_usec = 0;
/* usec */
if ((*exif_date == ',') || (*exif_date == '.')) {
glong mul = 100000;
while (g_ascii_isdigit (*++exif_date)) {
time_->tv_usec += (*exif_date - '0') * mul;
mul /= 10;
}
}
while (g_ascii_isspace (*exif_date))
exif_date++;
return *exif_date == '\0';
} | false | false | false | false | false | 0 |
processEndElement(const EndElementEvent &event,
Allocator &alloc)
{
Boolean wasArc = (openElementFlags_.back() & isArc);
openElementFlags_.resize(openElementFlags_.size() - 1);
if (wasArc) {
EndElementEvent *genEvent
= new (alloc) EndElementEvent(currentElement().type(),
metaDtd_,
event.location(),
0);
if (currentElement().included())
genEvent->setIncluded();
docHandler_->endElement(genEvent);
if (!currentElement().isFinished())
Messenger::message(ArcEngineMessages::unfinishedElement,
StringMessageArg(currentElement().type()->name()));
popElement();
}
} | false | false | false | false | false | 0 |
find_def_preds (VEC(use_pred_info_t, heap) ***preds,
size_t *num_preds, gimple phi)
{
size_t num_chains = 0, i, n;
VEC(edge, heap) **dep_chains = 0;
VEC(edge, heap) *cur_chain = 0;
VEC(edge, heap) *def_edges = 0;
bool has_valid_pred = false;
basic_block phi_bb, cd_root = 0;
struct pointer_set_t *visited_phis;
dep_chains = XCNEWVEC (VEC(edge, heap) *, MAX_NUM_CHAINS);
phi_bb = gimple_bb (phi);
/* First find the closest dominating bb to be
the control dependence root */
cd_root = find_dom (phi_bb);
if (!cd_root)
return false;
visited_phis = pointer_set_create ();
collect_phi_def_edges (phi, cd_root, &def_edges, visited_phis);
pointer_set_destroy (visited_phis);
n = VEC_length (edge, def_edges);
if (n == 0)
return false;
for (i = 0; i < n; i++)
{
size_t prev_nc, j;
edge opnd_edge;
opnd_edge = VEC_index (edge, def_edges, i);
prev_nc = num_chains;
compute_control_dep_chain (cd_root, opnd_edge->src,
dep_chains, &num_chains,
&cur_chain);
/* Free individual chain */
VEC_free (edge, heap, cur_chain);
cur_chain = 0;
/* Now update the newly added chains with
the phi operand edge: */
if (EDGE_COUNT (opnd_edge->src->succs) > 1)
{
if (prev_nc == num_chains
&& num_chains < MAX_NUM_CHAINS)
num_chains++;
for (j = prev_nc; j < num_chains; j++)
{
VEC_safe_push (edge, heap, dep_chains[j], opnd_edge);
}
}
}
has_valid_pred
= convert_control_dep_chain_into_preds (dep_chains,
num_chains,
preds,
num_preds);
for (i = 0; i < num_chains; i++)
VEC_free (edge, heap, dep_chains[i]);
free (dep_chains);
return has_valid_pred;
} | false | false | false | false | false | 0 |
alloc_workspace(void)
{
lzo_mem = vmalloc(LZO1X_MEM_COMPRESS);
lzo_compress_buf = vmalloc(lzo1x_worst_compress(PAGE_SIZE));
if (!lzo_mem || !lzo_compress_buf) {
free_workspace();
return -ENOMEM;
}
return 0;
} | false | false | false | false | false | 0 |
do_check(char * buffer, int try, unsigned int current_block) {
long got;
/* Seek to the correct loc. */
if (lseek(DEV, current_block * MINIX_BLOCK_SIZE, SEEK_SET) !=
current_block * MINIX_BLOCK_SIZE )
err(MKFS_ERROR, _("%s: seek failed during testing of blocks"),
device_name);
/* Try the read */
got = read(DEV, buffer, try * MINIX_BLOCK_SIZE);
if (got < 0) got = 0;
if (got & (MINIX_BLOCK_SIZE - 1 )) {
printf(_("Weird values in do_check: probably bugs\n"));
}
got /= MINIX_BLOCK_SIZE;
return got;
} | false | true | false | false | true | 1 |
cm_p7_oprofile_DestroyBlock(CM_P7_OM_BLOCK *block)
{
int i;
if (block == NULL) return;
if (block->list != NULL)
{
for (i = 0; i < block->listSize; ++i)
{
if (block->list[i] != NULL) p7_oprofile_Destroy(block->list[i]);
}
free(block->list);
}
if (block->cm_offsetA != NULL) free(block->cm_offsetA);
if (block->cm_clenA != NULL) free(block->cm_clenA);
if (block->cm_WA != NULL) free(block->cm_WA);
if (block->cm_nbpA != NULL) free(block->cm_nbpA);
if (block->gfmuA != NULL) free(block->gfmuA);
if (block->gflambdaA != NULL) free(block->gflambdaA);
free(block);
return;
} | false | false | false | false | false | 0 |
sorb_decimal_print (char buf[], int n)
{
int i;
for (i = 0; i < n; ++i) {
fprintf(stderr,"%4d ",buf[i]);
}
fprintf(stderr,"\n");
} | false | false | false | false | false | 0 |
wedge_angle(v_id)
vertex_id v_id;
{ int concount;
conmap_t *conmap = get_v_constraint_map(v_id);
REAL normal[2][MAXCOORD];
REAL c;
int j;
struct constraint *con;
REAL fval;
concount = conmap[0];
if ( concount == 0 ) return 2*M_PI;
if ( concount == 1 ) return M_PI;
/* two constraints, so find angle between */
if ( concount > 2 )
{ sprintf(errmsg,
"gauss_curvature_integral: More than two constraints on vertex %s.\n",
ELNAME(v_id));
kb_error(1593,errmsg,RECOVERABLE);
}
for ( j = 1, concount = 0 ; j <= (int)conmap[0] ; j++ )
{
con = get_constraint(conmap[j]);
eval_all(con->formula,get_coord(v_id),SDIM,&fval,normal[concount],v_id);
concount++;
}
c = SDIM_dot(normal[0],normal[1])
/sqrt(SDIM_dot(normal[0],normal[0]))
/sqrt(SDIM_dot(normal[1],normal[1]));
return M_PI - acos(c);
} | false | false | false | false | true | 1 |
deactivate_object(const PortableServer::ObjectId& oid)
{
// Once an object is targeted for deactivation, things happen in
// this order:
//
// o wait for requests to complete
// -- note that new requests can arrive in the mean time, so the
// deactivation may never actually complete! This is
// necessary to prevent deadlocks in objects which do
// re-entrant calls to themselves.
// o remove from active object map
// o etherealise
//
// It is not possible to reactivate the same object until the
// etherealisation stage has happened. Attempts to do so are blocked
// until it is safe to continue.
CHECK_NOT_NIL();
if( !pd_policy.retain_servants ) throw WrongPolicy();
omniObjKey key;
create_key(key, oid.NP_data(), oid.length());
CORBA::ULong hashv = omni::hash(key.key(), key.size());
pd_lock.lock();
if( pd_destroyed ) {
pd_lock.unlock();
OMNIORB_THROW(OBJECT_NOT_EXIST,OBJECT_NOT_EXIST_POANotInitialised,
CORBA::COMPLETED_NO);
}
omni::internalLock->lock();
omniObjTableEntry* entry = omniObjTable::locate(key.key(),key.size(),hashv);
if (!entry || entry->state() != omniObjTableEntry::ACTIVE) {
if (omniORB::trace(10) && entry) {
if (entry->state() == omniObjTableEntry::ACTIVATING) {
omniORB::logger l;
l << "deactivate_object() races with a thread activating the "
"object. ObjectNotActive is thrown.\n";
}
else if (entry->state() != omniObjTableEntry::ACTIVE) {
omniORB::logger l;
l << "deactivate_object() races with another thread deactivating the "
"object. ObjectNotActive is thrown.\n";
}
}
omni::internalLock->unlock();
pd_lock.unlock();
throw ObjectNotActive();
}
entry->setDeactivating();
entry->removeFromOAObjList();
if( entry->is_idle() ) {
detached_object();
pd_lock.unlock();
lastInvocationHasCompleted(entry);
}
else {
// When outstanding requests have completed the object
// will be etherealised.
omni::internalLock->unlock();
detached_object();
pd_lock.unlock();
omniORB::logs(15, "Object is still busy -- etherealise later.");
}
} | false | false | false | false | false | 0 |
mmap_base(unsigned long rnd)
{
unsigned long gap = rlimit(RLIMIT_STACK);
if (gap < MIN_GAP)
gap = MIN_GAP;
else if (gap > MAX_GAP)
gap = MAX_GAP;
return PAGE_ALIGN(TASK_SIZE - gap - rnd);
} | false | false | false | false | false | 0 |
L13()
{register object *base=vs_base;
register object *sup=base+VM13; VC13
vs_reserve(VM13);
{object V24;
object V25;
if(vs_top-vs_base>2) too_many_arguments();
if(vs_base>=vs_top){vs_top=sup;goto T57;}
V24=(base[0]);
vs_base++;
if(vs_base>=vs_top){vs_top=sup;goto T58;}
V25=(base[1]);
vs_top=sup;
goto T59;
goto T57;
T57:;
V24= ((object)VV[19]);
goto T58;
T58:;
V25= ((object)VV[19]);
goto T59;
T59:;
base[2]= list(3,((object)VV[24]),(V24),make_cons((V25),Cnil));
vs_top=(vs_base=base+2)+1;
return;
}
} | false | false | false | false | false | 0 |
addIndexedNormalRelatedWeight(Function* vsMain,
ParameterPtr& pNormalParam,
ParameterPtr& pNormalWorldRelatedParam,
int index, int& funcCounter)
{
FunctionInvocation* curFuncInvocation;
Operand::OpMask indexMask = indexToMask(index);
//multiply position with world matrix and put into temporary param
curFuncInvocation = OGRE_NEW FunctionInvocation(FFP_FUNC_TRANSFORM, FFP_VS_TRANSFORM, funcCounter++);
curFuncInvocation->pushOperand(mParamInWorldMatrices, Operand::OPS_IN, Operand::OPM_ALL);
curFuncInvocation->pushOperand(mParamInIndices, Operand::OPS_IN, indexMask, 1);
curFuncInvocation->pushOperand(pNormalParam, Operand::OPS_IN);
curFuncInvocation->pushOperand(mParamTempFloat3, Operand::OPS_OUT);
vsMain->addAtomInstance(curFuncInvocation);
//multiply temporary param with weight
curFuncInvocation = OGRE_NEW FunctionInvocation(FFP_FUNC_MODULATE, FFP_VS_TRANSFORM, funcCounter++);
curFuncInvocation->pushOperand(mParamTempFloat3, Operand::OPS_IN);
curFuncInvocation->pushOperand(mParamInWeights, Operand::OPS_IN, indexMask);
curFuncInvocation->pushOperand(mParamTempFloat3, Operand::OPS_OUT);
vsMain->addAtomInstance(curFuncInvocation);
//check if on first iteration
if (index == 0)
{
//set the local param as the value of the world normal
curFuncInvocation = OGRE_NEW FunctionInvocation(FFP_FUNC_ASSIGN, FFP_VS_TRANSFORM, funcCounter++);
curFuncInvocation->pushOperand(mParamTempFloat3, Operand::OPS_IN);
curFuncInvocation->pushOperand(pNormalWorldRelatedParam, Operand::OPS_OUT);
vsMain->addAtomInstance(curFuncInvocation);
}
else
{
//add the local param as the value of the world normal
curFuncInvocation = OGRE_NEW FunctionInvocation(FFP_FUNC_ADD, FFP_VS_TRANSFORM, funcCounter++);
curFuncInvocation->pushOperand(mParamTempFloat3, Operand::OPS_IN);
curFuncInvocation->pushOperand(pNormalWorldRelatedParam, Operand::OPS_IN);
curFuncInvocation->pushOperand(pNormalWorldRelatedParam, Operand::OPS_OUT);
vsMain->addAtomInstance(curFuncInvocation);
}
} | false | false | false | false | false | 0 |
bms_overlap(const Bitmapset *a, const Bitmapset *b)
{
int shortlen;
int i;
/* Handle cases where either input is NULL */
if (a == NULL || b == NULL)
return false;
/* Check words in common */
shortlen = Min(a->nwords, b->nwords);
for (i = 0; i < shortlen; i++)
{
if ((a->words[i] & b->words[i]) != 0)
return true;
}
return false;
} | false | false | false | false | true | 1 |
readChunk_tRNS(LodePNGColorMode* color, const unsigned char* data, size_t chunkLength)
{
unsigned i;
if(color->colortype == LCT_PALETTE)
{
/*error: more alpha values given than there are palette entries*/
if(chunkLength > color->palettesize) return 38;
for(i = 0; i != chunkLength; ++i) color->palette[4 * i + 3] = data[i];
}
else if(color->colortype == LCT_GREY)
{
/*error: this chunk must be 2 bytes for greyscale image*/
if(chunkLength != 2) return 30;
color->key_defined = 1;
color->key_r = color->key_g = color->key_b = 256u * data[0] + data[1];
}
else if(color->colortype == LCT_RGB)
{
/*error: this chunk must be 6 bytes for RGB image*/
if(chunkLength != 6) return 41;
color->key_defined = 1;
color->key_r = 256u * data[0] + data[1];
color->key_g = 256u * data[2] + data[3];
color->key_b = 256u * data[4] + data[5];
}
else return 42; /*error: tRNS chunk not allowed for other color models*/
return 0; /* OK */
} | false | false | false | false | false | 0 |
L29()
{register object *base=vs_base;
register object *sup=base+VM29; VC29
vs_check;
{object V58;
V58=(base[0]);
vs_top=sup;
goto TTL;
TTL:;
base[2]= ((object)VV[25]);
base[3]= ((object)VV[12]);
vs_top=(vs_base=base+2)+2;
(void) (*Lnk80)();
vs_top=sup;
base[1]= vs_base[0];
base[2]= (V58);
vs_top=(vs_base=base+1)+2;
(void) (*Lnk81)();
return;
}
} | false | false | false | false | false | 0 |
___finalize(GObject *obj_self)
{
#define __GOB_FUNCTION__ "Gmpc:MpdData:Model::finalize"
GmpcMpdDataModel *self G_GNUC_UNUSED = GMPC_MPDDATA_MODEL (obj_self);
gpointer priv G_GNUC_UNUSED = self->_priv;
#line 88 "gmpc-mpddata-model.gob"
if(self->_priv->req_artist) { g_free ((gpointer) self->_priv->req_artist); self->_priv->req_artist = NULL; }
#line 342 "gmpc-mpddata-model.c"
#line 89 "gmpc-mpddata-model.gob"
if(self->_priv->blank) { g_object_unref ((gpointer) self->_priv->blank); self->_priv->blank = NULL; }
#line 345 "gmpc-mpddata-model.c"
#line 97 "gmpc-mpddata-model.gob"
if(self->_priv->markup) { g_free ((gpointer) self->_priv->markup); self->_priv->markup = NULL; }
#line 348 "gmpc-mpddata-model.c"
#line 155 "gmpc-mpddata-model.gob"
___6_gmpc_mpddata_model_finalize(obj_self);
#line 351 "gmpc-mpddata-model.c"
} | false | false | false | false | false | 0 |
pnpacpi_encode_ext_irq(struct pnp_dev *dev,
struct acpi_resource *resource,
struct resource *p)
{
struct acpi_resource_extended_irq *extended_irq = &resource->data.extended_irq;
u8 triggering, polarity, shareable;
if (!pnp_resource_enabled(p)) {
extended_irq->interrupt_count = 0;
pnp_dbg(&dev->dev, " encode extended irq (%s)\n",
p ? "disabled" : "missing");
return;
}
decode_irq_flags(dev, p->flags, &triggering, &polarity, &shareable);
extended_irq->producer_consumer = ACPI_CONSUMER;
extended_irq->triggering = triggering;
extended_irq->polarity = polarity;
extended_irq->sharable = shareable;
extended_irq->interrupt_count = 1;
extended_irq->interrupts[0] = p->start;
pnp_dbg(&dev->dev, " encode irq %d %s %s %s\n", (int) p->start,
triggering == ACPI_LEVEL_SENSITIVE ? "level" : "edge",
polarity == ACPI_ACTIVE_LOW ? "low" : "high",
extended_irq->sharable == ACPI_SHARED ? "shared" : "exclusive");
} | false | false | false | false | false | 0 |
pstore_table_import_columns(struct pstore_table *self, const char *filename)
{
FILE *input;
struct fields_reader *reader;
struct fields_record *record;
unsigned long ndx;
input = fopen(filename, "r");
if (input == NULL)
die("fopen: %s", strerror(errno));
reader = fields_read_file(input, &dsv_iterator_format, &fields_defaults);
if (reader == NULL)
die("fields_read_file");
record = fields_record_alloc(&fields_defaults);
if (record == NULL)
die("fields_record_alloc");
if (fields_reader_read(reader, record) != 0)
die("fields_reader_read");
for (ndx = 0; ndx < fields_record_size(record); ndx++) {
struct fields_field field;
struct pstore_column *column;
if (fields_record_field(record, ndx, &field) != 0)
die("fields_record_field");
column = pstore_column_new(field.value, ndx, VALUE_TYPE_STRING);
if (column == NULL)
die("pstore_column_new");
if (pstore_table_add(self, column) < 0)
die("pstore_table_add");
}
fields_record_free(record);
fields_reader_free(reader);
fclose(input);
} | false | false | false | false | true | 1 |
pcxhr_update_r_buffer(struct pcxhr_stream *stream)
{
int err, is_capture, stream_num;
struct pcxhr_rmh rmh;
struct snd_pcm_substream *subs = stream->substream;
struct snd_pcxhr *chip = snd_pcm_substream_chip(subs);
is_capture = (subs->stream == SNDRV_PCM_STREAM_CAPTURE);
stream_num = is_capture ? 0 : subs->number;
dev_dbg(chip->card->dev,
"pcxhr_update_r_buffer(pcm%c%d) : addr(%p) bytes(%zx) subs(%d)\n",
is_capture ? 'c' : 'p',
chip->chip_idx, (void *)(long)subs->runtime->dma_addr,
subs->runtime->dma_bytes, subs->number);
pcxhr_init_rmh(&rmh, CMD_UPDATE_R_BUFFERS);
pcxhr_set_pipe_cmd_params(&rmh, is_capture, stream->pipe->first_audio,
stream_num, 0);
/* max buffer size is 2 MByte */
snd_BUG_ON(subs->runtime->dma_bytes >= 0x200000);
/* size in bits */
rmh.cmd[1] = subs->runtime->dma_bytes * 8;
/* most significant byte */
rmh.cmd[2] = subs->runtime->dma_addr >> 24;
/* this is a circular buffer */
rmh.cmd[2] |= 1<<19;
/* least 3 significant bytes */
rmh.cmd[3] = subs->runtime->dma_addr & MASK_DSP_WORD;
rmh.cmd_len = 4;
err = pcxhr_send_msg(chip->mgr, &rmh);
if (err)
dev_err(chip->card->dev,
"ERROR CMD_UPDATE_R_BUFFERS err=%x;\n", err);
return err;
} | false | false | false | false | false | 0 |
stack_init (iksparser *prs)
{
prs->stack = iks_malloc (128);
if (!prs->stack) return 0;
prs->stack_max = 128;
prs->stack_pos = 0;
return 1;
} | false | false | false | false | false | 0 |
trace_frame_exc(PyThreadState *tstate, PyFrameObject *f)
{
PyObject *type, *value, *traceback, *arg;
int err;
if (tstate->c_tracefunc == NULL)
return 0;
PyErr_Fetch(&type, &value, &traceback);
if (value == NULL) {
value = Py_None;
Py_INCREF(value);
}
arg = PyTuple_Pack(3, type, value, traceback);
if (arg == NULL) {
PyErr_Restore(type, value, traceback);
return 0;
}
err = trace_frame(tstate, f, PyTrace_EXCEPTION, arg);
Py_DECREF(arg);
if (err == 0)
PyErr_Restore(type, value, traceback);
else {
Py_XDECREF(type);
Py_XDECREF(value);
Py_XDECREF(traceback);
}
return err;
} | false | false | false | false | false | 0 |
drawGroupIcon()
{
if ( type_ == Group ) {
if ( childCount() == 0 )
setIcon(IconsetFactory::iconPtr("psi/groupEmpty"));
else if ( isOpen() )
setIcon(IconsetFactory::iconPtr("psi/groupOpen"));
else
setIcon(IconsetFactory::iconPtr("psi/groupClosed"));
}
else if ( type_ == Profile ) {
if ( !d->alerting )
setProfileState(d->status);
}
} | false | false | false | false | false | 0 |
menu_items_changed_cb(GtkContainer *container, GtkWidget *widget, GeanyMenubuttonAction *action)
{
GeanyMenubuttonActionPrivate *priv;
gboolean enable;
GSList *l;
g_return_if_fail(action != NULL);
priv = GEANY_MENU_BUTTON_ACTION_GET_PRIVATE(action);
if (priv->menu != NULL)
{
GList *children = gtk_container_get_children(GTK_CONTAINER(priv->menu));
enable = (g_list_length(children) > 0);
g_list_free(children);
}
else
enable = FALSE;
foreach_slist(l, gtk_action_get_proxies(GTK_ACTION(action)))
{
/* On Windows a GtkImageMenuItem proxy is created for whatever reason. So we filter
* by type and act only on GtkMenuToolButton proxies. */
/* TODO find why the GtkImageMenuItem proxy is created */
if (! GTK_IS_MENU_TOOL_BUTTON(l->data))
continue;
if (enable)
{
if (gtk_menu_tool_button_get_menu(GTK_MENU_TOOL_BUTTON(l->data)) == NULL)
gtk_menu_tool_button_set_menu(GTK_MENU_TOOL_BUTTON(l->data), priv->menu);
}
else
gtk_menu_tool_button_set_menu(GTK_MENU_TOOL_BUTTON(l->data), NULL);
}
} | false | false | false | false | false | 0 |
alloc_real_var(struct net_t *np, int32 insts)
{
register int32 i;
int32 arrw, totchars;
double *dp;
/* case 1: new real array - must be malloced */
/* must malloc arrays because they can be large */
if (np->n_isarr)
{
arrw = __get_arrwide(np);
totchars = arrw*(2*WRDBYTES*insts*wlen_(REALBITS));
np->nva.wp = (word32 *) __my_malloc(totchars);
/* reals arrays contiguous a/b 8 bytes with no x/z */
dp = np->nva.dp;
for (i = 0; i < arrw*insts; i++)
{
*dp++ = 0.0;
}
__arrvmem_use += totchars;
return;
}
/* case 2 non array */
np->nva.wp = (word32 *) &(__wtab[__wtabwi]);
dp = np->nva.dp;
for (i = 0; i < insts; i++) *dp++ = 0.0;
__wtabwi += 2*insts;
} | false | false | false | false | false | 0 |
PAINT_end()
{
GB_PAINT *paint;
if (!_current)
return;
paint = _current;
_current = _current->previous;
PAINT_close(paint);
if (paint->draw)
DRAW_open(paint->draw);
if (paint->brush)
GB.Unref(POINTER(&paint->brush));
GB.Unref(POINTER(&paint->device));
GB.Free(POINTER(&paint));
} | false | false | false | false | false | 0 |
countMembers() {
// This bit counter is good for sparse numbers of '1's, which is
// very much the case that we will usually have.
int32_t count = 0;
for (uint32_t i=0; i<sizeof(bits)/sizeof(uint32_t); i++) {
uint32_t x = bits[i];
while (x > 0) {
count++;
x &= (x - 1); // and off the least significant one bit.
}
}
return count;
} | false | false | false | false | false | 0 |
rlm_sql_query(SQLSOCK *sqlsocket, SQL_INST *inst, char *query)
{
int ret;
/*
* If there's no query, return an error.
*/
if (!query || !*query) {
return -1;
}
if (sqlsocket->conn) {
ret = (inst->module->sql_query)(sqlsocket, inst->config, query);
} else {
ret = SQL_DOWN;
}
if (ret == SQL_DOWN) {
sqlsocket = fr_connection_reconnect(inst->pool, sqlsocket);
if (!sqlsocket) return -1;
/* retry the query on the newly connected socket */
ret = (inst->module->sql_query)(sqlsocket, inst->config, query);
if (ret) {
radlog(L_ERR, "rlm_sql (%s): failed after re-connect",
inst->config->xlat_name);
return -1;
}
}
return ret;
} | false | false | false | false | false | 0 |
alsa_get_unmute_volume( void )
{
long val;
if (elem == NULL)
return -1;
if (snd_mixer_selem_is_playback_mono(elem)) {
snd_mixer_selem_get_playback_volume(elem, SND_MIXER_SCHN_MONO, &val);
return val;
} else {
int c, n = 0;
long sum = 0;
for (c = 0; c <= SND_MIXER_SCHN_LAST; c++) {
if (snd_mixer_selem_has_playback_channel(elem, c)) {
snd_mixer_selem_get_playback_volume(elem, SND_MIXER_SCHN_FRONT_LEFT, &val);
sum += val;
n++;
}
}
if (! n) {
return 0;
}
val = sum / n;
sum = (long)((double)(alsa_vol * (alsa_max - alsa_min)) / 100. + 0.5);
if (sum != val) {
alsa_vol = (long)(((val * 100.) / (alsa_max - alsa_min)) + 0.5);
}
return alsa_vol;
}
} | false | false | false | false | false | 0 |
ResetPetCombat()
{
Unit* pOwner = m_creature->GetCharmerOrOwner();
if (pOwner && m_creature->GetCharmInfo() && m_creature->GetCharmInfo()->HasCommandState(COMMAND_FOLLOW))
{
m_creature->GetMotionMaster()->MoveFollow(pOwner, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
}
else
{
m_creature->GetMotionMaster()->Clear(false);
m_creature->GetMotionMaster()->MoveIdle();
}
m_creature->AttackStop();
debug_log("SD2: ScriptedPetAI reset pet combat and stop attack.");
Reset();
} | false | false | false | false | false | 0 |
SetSpatialFilter( OGRGeometry * poGeom )
{
if (bStreamingDS)
bReloadNeeded = TRUE;
else if (poFetchedFilterGeom == NULL && poBaseDS != NULL)
{
/* If there was no filter set, and that we set one */
/* the new result set can only be a subset of the whole */
/* so no need to reload from source */
bReloadNeeded = FALSE;
}
else if (poFetchedFilterGeom != NULL && poGeom != NULL && poBaseDS != NULL)
{
OGREnvelope oOldEnvelope, oNewEnvelope;
poFetchedFilterGeom->getEnvelope(&oOldEnvelope);
poGeom->getEnvelope(&oNewEnvelope);
/* Optimization : we don't need to request the server */
/* if the new BBOX is inside the old BBOX as we have */
/* already all the features */
bReloadNeeded = ! oOldEnvelope.Contains(oNewEnvelope);
}
else
bReloadNeeded = TRUE;
nFeatures = -1;
OGRLayer::SetSpatialFilter(poGeom);
ResetReading();
} | false | false | false | false | false | 0 |
assert_reset_soft(bool should_be_detached)
{
git_oid oid;
cl_git_pass(git_reference_name_to_id(&oid, repo, "HEAD"));
cl_git_fail(git_oid_streq(&oid, KNOWN_COMMIT_IN_BARE_REPO));
cl_git_pass(git_revparse_single(&target, repo, KNOWN_COMMIT_IN_BARE_REPO));
cl_assert(git_repository_head_detached(repo) == should_be_detached);
cl_git_pass(git_reset(repo, target, GIT_RESET_SOFT, NULL, NULL, NULL));
cl_assert(git_repository_head_detached(repo) == should_be_detached);
cl_git_pass(git_reference_name_to_id(&oid, repo, "HEAD"));
cl_git_pass(git_oid_streq(&oid, KNOWN_COMMIT_IN_BARE_REPO));
} | false | false | false | false | false | 0 |
isASyntaxOrMrPluginOrPss(Slapi_Entry *e)
{
char *ptype = slapi_entry_attr_get_charptr(e, ATTR_PLUGIN_TYPE);
int retval = (ptype && !strcasecmp(ptype, "syntax"));
if (!retval)
retval = (ptype && !strcasecmp(ptype, "matchingrule"));
if (!retval)
retval = (ptype && !strcasecmp(ptype, "pwdstoragescheme"));
if (!retval)
retval = (ptype && !strcasecmp(ptype, "reverpwdstoragescheme"));
slapi_ch_free_string(&ptype);
return retval;
} | false | false | false | false | false | 0 |
operator()(const SurfacePoint &sp) {
if (DistanceSquared(sp.p, p) < maxDist2) {
failed = true; return false;
}
return true;
} | false | false | false | false | false | 0 |
toBase(unsigned int value, unsigned int base, char*& ptr){
static const char* hex="0123456789ABCDEF";
int rest = value % base;
if(value >= base)
toBase( (value-rest)/base, base, ptr);
*ptr++=(char)hex[rest];
} | false | false | false | false | false | 0 |
copy_equiv_class (vla_ptr_t *to, const vla_ptr_t *from)
{
state_t *class_ptr;
VLA_PTR_NULLIFY (*to);
for (class_ptr = VLA_PTR_BEGIN (*from);
class_ptr <= (state_t *) VLA_PTR_LAST (*from);
class_ptr++)
VLA_PTR_ADD (*to, *class_ptr);
} | false | false | false | false | false | 0 |
compute_topo_order (constraint_graph_t graph,
struct topo_info *ti)
{
unsigned int i;
unsigned int size = graph->size;
for (i = 0; i != size; ++i)
if (!TEST_BIT (ti->visited, i) && find (i) == i)
topo_visit (graph, ti, i);
} | false | false | false | false | false | 0 |
slurm_cred_ctx_set(slurm_cred_ctx_t ctx, slurm_cred_opt_t opt, ...)
{
int rc = SLURM_SUCCESS;
va_list ap;
xassert(ctx != NULL);
va_start(ap, opt);
slurm_mutex_lock(&ctx->mutex);
xassert(ctx->magic == CRED_CTX_MAGIC);
switch (opt) {
case SLURM_CRED_OPT_EXPIRY_WINDOW:
ctx->expiry_window = va_arg(ap, int);
break;
default:
slurm_seterrno(EINVAL);
rc = SLURM_ERROR;
break;
}
slurm_mutex_unlock(&ctx->mutex);
va_end(ap);
return rc;
} | false | false | false | false | false | 0 |
removeFromActiveQ(sys_thread_t * t)
{
sys_thread_t *prev;
sys_thread_t *tid;
sysAssert(SYS_QUEUE_LOCKED(sysThreadSelf()));
ActiveThreadCount--;
prev = 0;
tid = ThreadQueue;
while (tid) {
if (tid == t) {
if (prev) {
prev->next = tid->next;
} else {
ThreadQueue = tid->next;
}
tid->next = 0;
break;
}
prev = tid;
tid = tid->next;
}
} | false | false | false | false | false | 0 |
read_string (const char *text)
{
char *p;
char *s = strdup (text);
if (*s == '\"') {
s++;
}
for (p = s; *p; p++) {
if (*p == '\"') {
*p = '\0';
}
}
return s;
} | false | false | false | false | false | 0 |
bnxt_hwrm_queue_pfc_cfg(struct bnxt *bp, struct ieee_pfc *pfc)
{
struct hwrm_queue_pfcenable_cfg_input req = {0};
struct ieee_ets *my_ets = bp->ieee_ets;
unsigned int tc_mask = 0, pri_mask = 0;
u8 i, pri, lltc_count = 0;
bool need_q_recfg = false;
int rc;
if (!my_ets)
return -EINVAL;
for (i = 0; i < bp->max_tc; i++) {
for (pri = 0; pri < IEEE_8021QAZ_MAX_TCS; pri++) {
if ((pfc->pfc_en & (1 << pri)) &&
(my_ets->prio_tc[pri] == i)) {
pri_mask |= 1 << pri;
tc_mask |= 1 << i;
}
}
if (tc_mask & (1 << i))
lltc_count++;
}
if (lltc_count > bp->max_lltc)
return -EINVAL;
bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_QUEUE_PFCENABLE_CFG, -1, -1);
req.flags = cpu_to_le32(pri_mask);
rc = hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
if (rc)
return rc;
for (i = 0; i < bp->max_tc; i++) {
if (tc_mask & (1 << i)) {
if (!BNXT_LLQ(bp->q_info[i].queue_profile))
need_q_recfg = true;
}
}
if (need_q_recfg)
rc = bnxt_hwrm_queue_cfg(bp, tc_mask);
return rc;
} | false | false | false | false | false | 0 |
nct6683_fan_is_visible(struct kobject *kobj,
struct attribute *attr, int index)
{
struct device *dev = container_of(kobj, struct device, kobj);
struct nct6683_data *data = dev_get_drvdata(dev);
int fan = index / 3; /* fan index */
int nr = index % 3; /* attribute index */
if (!(data->have_fan & (1 << fan)))
return 0;
/*
* Intel may have minimum fan speed limits,
* but register location and encoding are unknown.
*/
if (nr == 2 && data->customer_id == NCT6683_CUSTOMER_ID_INTEL)
return 0;
return attr->mode;
} | false | false | false | false | false | 0 |
Flush()
{
if( fStream != NULL)
{
fStream->flush();
}
if( ogzStream != NULL)
{
ogzStream->flush();
}
} | false | false | false | false | false | 0 |
isBinaryOpUsed(BinaryOpcode opcode) const
{
for (binary_op_node_map_t::const_iterator it = binary_op_node_map.begin();
it != binary_op_node_map.end(); it++)
if (it->first.second == opcode)
return true;
return false;
} | false | false | false | false | false | 0 |
c67x00_drv_remove(struct platform_device *pdev)
{
struct c67x00_device *c67x00 = platform_get_drvdata(pdev);
struct resource *res;
int i;
for (i = 0; i < C67X00_SIES; i++)
c67x00_remove_sie(&c67x00->sie[i]);
c67x00_ll_release(c67x00);
res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if (res)
free_irq(res->start, c67x00);
iounmap(c67x00->hpi.base);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (res)
release_mem_region(res->start, resource_size(res));
kfree(c67x00);
return 0;
} | false | false | false | false | false | 0 |
clampr(float *x, float min, float max) {
bool ret = false;
if( *x < min ) {
*x = min;
ret = true;
} else if( *x > max ) {
*x = max;
ret = true;
}
return ret;
} | false | false | false | false | false | 0 |
remove_bus_watch (gpointer user_data)
{
guint watch_id = GPOINTER_TO_INT(user_data);
UNITY_WEBAPPS_NOTE(INTEREST, "REMOVING BUS WATCH FOR %d", watch_id);
g_bus_unwatch_name (watch_id);
return FALSE;
} | false | false | false | false | false | 0 |
spl_display_checklimits(GtkWidget *spl_window) {
SPLWizard *spl_wizard;
Playlist *spl;
GtkWidget *w;
spl_wizard = get_spl_wizard();
g_return_if_fail (spl_wizard);
spl = g_object_get_data(G_OBJECT (spl_wizard->window), "spl_work");
g_return_if_fail (spl);
if ((w = gtkpod_builder_xml_get_widget(spl_wizard->builder, "spl_checklimits_button"))) {
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (w), spl->splpref.checklimits);
g_signal_connect (w, "toggled",
G_CALLBACK (spl_checklimits_toggled),
spl_wizard->window);
}
if ((w = gtkpod_builder_xml_get_widget(spl_wizard->builder, "spl_limitvalue_entry"))) {
gchar str[WNLEN];
snprintf(str, WNLEN, "%d", spl->splpref.limitvalue);
gtk_entry_set_text(GTK_ENTRY (w), str);
gtk_widget_set_sensitive(w, spl->splpref.checklimits);
g_signal_connect (w, "changed",
G_CALLBACK (spl_limitvalue_changed),
spl_wizard->window);
}
if ((w = gtkpod_builder_xml_get_widget(spl_wizard->builder, "spl_limittype_combobox"))) {
spl_set_combobox(GTK_COMBO_BOX (w), limittype_comboentries, spl->splpref.limittype, G_CALLBACK (spl_limittype_changed), spl_window);
gtk_widget_set_sensitive(w, spl->splpref.checklimits);
}
if ((w = gtkpod_builder_xml_get_widget(spl_wizard->builder, "spl_limitsort_label"))) {
gtk_widget_set_sensitive(w, spl->splpref.checklimits);
}
if ((w = gtkpod_builder_xml_get_widget(spl_wizard->builder, "spl_limitsort_combobox"))) {
spl_set_combobox(GTK_COMBO_BOX (w), limitsort_comboentries, spl->splpref.limitsort, G_CALLBACK (spl_limitsort_changed), spl_window);
gtk_widget_set_sensitive(w, spl->splpref.checklimits);
}
} | false | false | false | false | false | 0 |
t4vf_get_dev_params(struct adapter *adapter)
{
struct dev_params *dev_params = &adapter->params.dev;
u32 params[7], vals[7];
int v;
params[0] = (FW_PARAMS_MNEM_V(FW_PARAMS_MNEM_DEV) |
FW_PARAMS_PARAM_X_V(FW_PARAMS_PARAM_DEV_FWREV));
params[1] = (FW_PARAMS_MNEM_V(FW_PARAMS_MNEM_DEV) |
FW_PARAMS_PARAM_X_V(FW_PARAMS_PARAM_DEV_TPREV));
v = t4vf_query_params(adapter, 2, params, vals);
if (v)
return v;
dev_params->fwrev = vals[0];
dev_params->tprev = vals[1];
return 0;
} | false | false | false | false | false | 0 |
count_abook_entries_on_disk(AdrBk *ab, a_c_arg_t *deleted)
{
FILE *fp_in;
char *nickname;
adrbk_cntr_t count = 0;
adrbk_cntr_t deleted_count = 0;
int rew = 1;
char nickbuf[50];
if(!ab || !ab->fp)
return -1;
fp_in = ab->fp;
while((nickname = get_next_abook_entry(fp_in, rew)) != NULL){
rew = 0;
strncpy(nickbuf, nickname, sizeof(nickbuf));
nickbuf[sizeof(nickbuf)-1] = '\0';
fs_give((void **) &nickname);
if(strncmp(nickbuf, DELETED, DELETED_LEN) == 0
&& isdigit((unsigned char)nickbuf[DELETED_LEN])
&& isdigit((unsigned char)nickbuf[DELETED_LEN+1])
&& nickbuf[DELETED_LEN+2] == '/'
&& isdigit((unsigned char)nickbuf[DELETED_LEN+3])
&& isdigit((unsigned char)nickbuf[DELETED_LEN+4])
&& nickbuf[DELETED_LEN+5] == '/'
&& isdigit((unsigned char)nickbuf[DELETED_LEN+6])
&& isdigit((unsigned char)nickbuf[DELETED_LEN+7])
&& nickbuf[DELETED_LEN+8] == '#'){
deleted_count++;
continue;
}
count++;
}
if(deleted)
*deleted = (a_c_arg_t) deleted_count;
return(count);
} | false | false | false | false | false | 0 |
e_ews_item_finalize (GObject *object)
{
EEwsItem *item = (EEwsItem *) object;
EEwsItemPrivate *priv;
g_return_if_fail (E_IS_EWS_ITEM (item));
priv = item->priv;
/* clean up */
g_free (priv);
item->priv = NULL;
if (parent_class->finalize)
(* parent_class->finalize) (object);
} | false | false | false | false | false | 0 |
vertice_get_or_build (long id, Vertex ** vertices, int max_size, int * num_vertices)
{
if (id <= 0 || id >= max_size)
return NULL;
int index = id - 1;
Vertex * vertex = vertices[index];
if (vertex == NULL) {
vertex = vertex_new (id);
vertices[index] = vertex;
*num_vertices = *num_vertices + 1;
}
return vertex;
} | false | false | false | false | false | 0 |
find_pxe_server_type(EFI_PXE_BASE_CODE *pxe)
{
INTN i = 0, max;
UINT8 tag, length;
UINT8 *opts = pxe->Mode->PxeReply.Dhcpv4.DhcpOptions;
UINT16 server_type;
while(i < 55) {
tag = opts[i];
length = opts[i+1];
DBG_PRT((L"Tag #%d Length %d\n",tag, length));
if (tag == 43) goto found;
i += 2 + length;
}
return NETFS_DEFAULT_SERVER_TYPE;
found:
max = i+2+length;
i += 2;
while (i < max) {
tag = opts[i];
length = opts[i+1];
if (tag == 71) {
server_type =(opts[i+2]<<8) | opts[i+3];
DBG_PRT((L"ServerType: %d\n", server_type));
return server_type;
}
i+= 2 + length;
}
return NETFS_DEFAULT_SERVER_TYPE;
} | false | false | false | false | false | 0 |
rtw_get_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
{
struct list_head *plist, *phead;
struct sta_info *psta = NULL;
u32 index;
u8 *addr;
u8 bc_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
if (!hwaddr)
return NULL;
if (IS_MCAST(hwaddr))
addr = bc_addr;
else
addr = hwaddr;
index = wifi_mac_hash(addr);
spin_lock_bh(&pstapriv->sta_hash_lock);
phead = &(pstapriv->sta_hash[index]);
plist = phead->next;
while (phead != plist) {
psta = container_of(plist, struct sta_info, hash_list);
if ((!memcmp(psta->hwaddr, addr, ETH_ALEN)) == true) {
/* if found the matched address */
break;
}
psta = NULL;
plist = plist->next;
}
spin_unlock_bh(&pstapriv->sta_hash_lock);
return psta;
} | false | false | false | false | false | 0 |
gnibbles_load_pixmap_file (const gchar * pixmap, gint xsize, gint ysize)
{
GdkPixbuf *image;
gchar *filename;
filename = g_build_filename (DATA_DIRECTORY, "pixmaps", pixmap, NULL);
if (!filename) {
char *message =
g_strdup_printf (_("Nibbles couldn't find pixmap file:\n%s\n\n"
"Please check your Nibbles installation"), pixmap);
gnibbles_error (message);
g_free(message);
}
image = gdk_pixbuf_new_from_file_at_scale (filename, xsize, ysize, TRUE, NULL);
g_free (filename);
return image;
} | false | false | false | false | false | 0 |
copy(FieldInterface * p)
{
for(int i = 0; i < mHeight; i++)
{
for(int j = 0; j < mWidth; j++)
{
maBoard[i][j] = p->getCell(j, i);
}
}
} | false | false | false | false | false | 0 |
sys_task_uniform(
long* seed, /*!< Pointer to seed value to use and store new seed in */
long start, /*!< Beginning range */
long end /*!< Ending range */
) { PROFILE(SYS_TASK_UNIFORM);
double d = 0.00000011920928955078125;
double a, b, c;
unsigned long oldseed, newseed;
oldseed = *seed;
if( oldseed == 0 )
oldseed = 259341593;
if( start >= end ) {
a = 0.0;
b = 2147483647.0;
} else {
a = (double)start;
b = (double)end;
}
/* Original routine used signed arithmetic, and the (frequent)
* overflows trigger "Undefined Behavior" according to the
* C standard (both c89 and c99). Using unsigned arithmetic
* forces a conforming C implementation to get the result
* that the IEEE-1364-2001 committee wants.
*/
newseed = 69069 * oldseed + 1;
/* Emulate a 32-bit unsigned long, even if the native machine
* uses wider words.
*/
#if ULONG_MAX > 4294967295UL
newseed = newseed & 4294967295UL;
#endif
*seed = newseed;
/* Equivalent conversion without assuming IEEE 32-bit float */
/* constant is 2^(-23) */
c = 1.0 + (newseed >> 9) * 0.00000011920928955078125;
c = c + (c*d);
c = ((b - a) * (c - 1.0)) + a;
PROFILE_END;
return( c );
} | false | false | false | false | false | 0 |
e1000e_get_auto_rd_done(struct e1000_hw *hw)
{
s32 i = 0;
s32 ret_val = E1000_SUCCESS;
while (i < AUTO_READ_DONE_TIMEOUT) {
if (er32(EECD) & E1000_EECD_AUTO_RD)
break;
msleep(1);
i++;
}
if (i == AUTO_READ_DONE_TIMEOUT) {
e_dbg("Auto read by HW from NVM has not completed.\n");
ret_val = -E1000_ERR_RESET;
goto out;
}
out:
return ret_val;
} | false | false | false | false | false | 0 |
rb_dlcfunc_initialize(int argc, VALUE argv[], VALUE self)
{
VALUE addr, name, type, calltype, addrnum;
struct cfunc_data *data;
void *saddr;
const char *sname;
rb_scan_args(argc, argv, "13", &addr, &type, &name, &calltype);
addrnum = rb_Integer(addr);
saddr = (void*)(NUM2PTR(addrnum));
sname = NIL_P(name) ? NULL : StringValuePtr(name);
TypedData_Get_Struct(self, struct cfunc_data, &dlcfunc_data_type, data);
if( data->name ) xfree(data->name);
data->ptr = saddr;
data->name = sname ? strdup(sname) : 0;
data->type = NIL_P(type) ? DLTYPE_VOID : NUM2INT(type);
data->calltype = NIL_P(calltype) ? CFUNC_CDECL : SYM2ID(calltype);
data->wrap = (addrnum == addr) ? 0 : addr;
return Qnil;
} | false | false | false | false | false | 0 |
jas_iccattrtab_replace(jas_iccattrtab_t *attrtab, int i,
jas_iccuint32_t name, jas_iccattrval_t *val)
{
jas_iccattrval_t *newval;
jas_iccattr_t *attr;
if (!(newval = jas_iccattrval_clone(val)))
goto error;
attr = &attrtab->attrs[i];
jas_iccattrval_destroy(attr->val);
attr->name = name;
attr->val = newval;
return 0;
error:
return -1;
} | false | false | false | false | false | 0 |
GKIFree(GKI *hash)
{
struct gki_elem *ptr;
int i;
if (hash == NULL) return; /* tolerate a NULL */
for (i = 0; i < hash->nhash; i++)
while (hash->table[i] != NULL)
{
ptr = hash->table[i]->nxt;
/* NULL keys can occur after we've gki_upsize'd */
if (hash->table[i]->key != NULL) free(hash->table[i]->key);
free(hash->table[i]);
hash->table[i] = ptr;
}
free(hash->table);
free(hash);
} | false | false | false | false | false | 0 |
getOpenUrl(QWidget *parent, const QString &caption, const Url &dir, const QString &filter)
{
const QStringList filterList = filter.split('\n');
QString parsedFilter;
for (int i = 0; i < filterList.size(); ++i)
{
const QStringList filterItems = filterList.at(i).split('|');
if (i > 0)
parsedFilter += ";;";
parsedFilter += filterItems.at(1) + " (" + filterItems.at(0) + ')';
}
const QString openFileName = QFileDialog::getOpenFileName(parent, caption, dir.path(), parsedFilter);
if (openFileName.isEmpty())
return Url();
return Url(openFileName);
} | false | false | false | false | false | 0 |
action_examine_all_end (Unit *unit, dpacket packet)
{
uae_u32 id;
uae_u32 doserr = 0;
ExAllKey *eak;
uaecptr control = GET_PCK_ARG5 (packet);
if (kickstart_version < 36)
return 0;
id = get_long (control + 4);
eak = getexall (unit, control, id);
#if EXALL_DEBUG > 0
write_log (_T("EXALL_END ID=%d %x\n"), id, eak);
#endif
if (!eak) {
write_log (_T("FILESYS: EXALL_END non-existing ID %d\n"), id);
doserr = ERROR_OBJECT_WRONG_TYPE;
} else {
eak->id = 0;
fs_closedir (eak->dirhandle);
xfree (eak->fn);
eak->fn = NULL;
eak->dirhandle = NULL;
}
if (doserr) {
PUT_PCK_RES1 (packet, DOS_FALSE);
PUT_PCK_RES2 (packet, doserr);
} else {
PUT_PCK_RES1 (packet, DOS_TRUE);
}
return 1;
} | false | false | false | false | false | 0 |
sym53c8xx_intr(int irq, void *dev_id)
{
struct Scsi_Host *shost = dev_id;
struct sym_data *sym_data = shost_priv(shost);
irqreturn_t result;
/* Avoid spinloop trying to handle interrupts on frozen device */
if (pci_channel_offline(sym_data->pdev))
return IRQ_NONE;
if (DEBUG_FLAGS & DEBUG_TINY) printf_debug ("[");
spin_lock(shost->host_lock);
result = sym_interrupt(shost);
spin_unlock(shost->host_lock);
if (DEBUG_FLAGS & DEBUG_TINY) printf_debug ("]\n");
return result;
} | false | false | false | false | false | 0 |
get_next_tr_id(void)
{
transfer *tr;
while(1)
{
gdata.next_tr_id++;
gdata.next_tr_id %= max2((MAXTRANS * 3) / 2, 1000);
gdata.next_tr_id = max2(1,gdata.next_tr_id);
tr = does_tr_id_exist(gdata.next_tr_id);
if (!tr)
{
return gdata.next_tr_id;
}
}
} | false | false | false | false | false | 0 |
NormalizePath() const {
char *path = new char[fileName.length() + 1];
strcpy(path, AsInternal());
#ifdef WIN32
// Convert unix path separators to Windows
for (char *cp = path; *cp; cp++) {
if (*cp == '/')
*cp = pathSepChar;
}
#endif
char *absPath = new char[fileName.length() + 1];
char *cur = absPath;
*cur = '\0';
char *tmp = path;
if (*tmp == pathSepChar) {
*cur++ = pathSepChar;
*cur = '\0';
tmp++;
}
char *part;
while ((part = split(tmp, pathSepChar)) != NULL) {
char *last;
if (strcmp(part, ".") == 0)
;
else if (strcmp(part, "..") == 0 && (last = strrchr(absPath, pathSepChar)) != NULL) {
if (last > absPath)
cur = last;
else
cur = last + 1;
*cur = '\0';
} else {
if (cur > absPath && *(cur - 1) != pathSepChar)
*cur++ = pathSepChar;
strcpy(cur, part);
cur += strlen(part);
}
}
FilePath ret(absPath);
delete []path;
delete []absPath;
return ret;
} | false | false | false | false | false | 0 |
G_CheckSpot
( int playernum,
mapthing_t* mthing )
{
fixed_t x;
fixed_t y;
subsector_t* ss;
unsigned an;
mobj_t* mo;
int i;
if (!players[playernum].mo)
{
// first spawn of level, before corpses
for (i=0 ; i<playernum ; i++)
if (players[i].mo->x == mthing->x << FRACBITS
&& players[i].mo->y == mthing->y << FRACBITS)
return false;
return true;
}
x = mthing->x << FRACBITS;
y = mthing->y << FRACBITS;
if (!P_CheckPosition (players[playernum].mo, x, y) )
return false;
// flush an old corpse if needed
if (bodyqueslot >= BODYQUESIZE)
P_RemoveMobj (bodyque[bodyqueslot%BODYQUESIZE]);
bodyque[bodyqueslot%BODYQUESIZE] = players[playernum].mo;
bodyqueslot++;
// spawn a teleport fog
ss = R_PointInSubsector (x,y);
an = ( ANG45 * (((unsigned int) mthing->angle)/45) ) >> ANGLETOFINESHIFT;
mo = P_SpawnMobj (x+20*finecosine[an], y+20*finesine[an]
, ss->sector->floorheight
, MT_TFOG);
if (players[consoleplayer].viewz != 1)
S_StartSound (mo, sfx_telept); // don't start sound on first frame
return true;
} | false | false | false | false | false | 0 |
ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional string name = 1;
if (has_name()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->name());
}
// optional .google.protobuf.ServiceOptions options = 3;
if (has_options()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->options());
}
}
// repeated .google.protobuf.MethodDescriptorProto method = 2;
total_size += 1 * this->method_size();
for (int i = 0; i < this->method_size(); i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->method(i));
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
} | false | false | false | false | false | 0 |
readFile(const char* fileName)
{
int fd = open(fileName, O_RDONLY);
if (fd < 0) {
fprintf(stderr, "Error opening %s", fileName);
return UString();
}
struct stat buf;
if (fstat(fd, &buf) == -1) {
fprintf(stderr, "Error stat'ing %s", fileName);
close(fd);
return UString();
}
int siz = buf.st_size;
char* c = new char[siz + 1];
int dataRead = read(fd, c, siz);
if (dataRead == -1) {
fprintf(stderr, "Error reading from %s", fileName);
delete[] c;
close(fd);
return UString();
}
c[dataRead] = '\0';
UString s = c;
delete[] c;
return s;
} | false | false | false | false | false | 0 |
restoringSession()
{
return d->firstInstance && isSessionRestored();
} | false | false | false | false | false | 0 |
gncVendorCreate (QofBook *book)
{
GncVendor *vendor;
if (!book) return NULL;
vendor = g_object_new (GNC_TYPE_VENDOR, NULL);
qof_instance_init_data (&vendor->inst, _GNC_MOD_NAME, book);
vendor->id = CACHE_INSERT ("");
vendor->name = CACHE_INSERT ("");
vendor->notes = CACHE_INSERT ("");
vendor->addr = gncAddressCreate (book, &vendor->inst);
vendor->taxincluded = GNC_TAXINCLUDED_USEGLOBAL;
vendor->active = TRUE;
vendor->jobs = NULL;
if (gs_address_event_handler_id == 0)
{
gs_address_event_handler_id = qof_event_register_handler(listen_for_address_events, NULL);
}
qof_event_gen (&vendor->inst, QOF_EVENT_CREATE, NULL);
return vendor;
} | false | false | false | false | false | 0 |
commit_add_row(struct record_stat* rst,
const char* sname, struct trie_node* node)
{
FILE* fp;
int i;
fp = fopen(rst->journal_fn, "a");
if (fp == NULL) {
return;
}
write_string(fp, "ADD \"");
write_quote_string(fp, sname);
write_string(fp, "\" S\"");
write_quote_xstr(fp, &node->row.key, rst->encoding);
write_string(fp, "\"");
for (i = 0; i < node->row.nr_vals; i++) {
switch (node->row.vals[i].type) {
case RT_EMPTY:
write_string(fp, " E");
break;
case RT_VAL:
write_string(fp, " N");
write_number(fp, node->row.vals[i].u.val);
break;
case RT_XSTR:
write_string(fp, " S\"");
write_quote_xstr(fp, &node->row.vals[i].u.str, rst->encoding);
write_string(fp, "\"");
break;
case RT_XSTRP:
write_string(fp, " S\"");
write_quote_xstr(fp, node->row.vals[i].u.strp, rst->encoding);
write_string(fp, "\"");
break;
}
}
write_string(fp, "\n");
rst->last_update = ftell(fp);
fclose(fp);
} | false | false | false | false | true | 1 |
DestroyDeletedFileNodes()
/*
* FUNCTION: Destroys file nodes that are marked for deletion
*/
{
PCFFILE_NODE CurNode;
PCFFILE_NODE NextNode;
CurNode = FileListHead;
while (CurNode != NULL)
{
NextNode = CurNode->Next;
if (CurNode->Delete)
{
if (CurNode->Prev != NULL)
CurNode->Prev->Next = CurNode->Next;
else
{
FileListHead = CurNode->Next;
if (FileListHead)
FileListHead->Prev = NULL;
}
if (CurNode->Next != NULL)
CurNode->Next->Prev = CurNode->Prev;
else
{
FileListTail = CurNode->Prev;
if (FileListTail)
FileListTail->Next = NULL;
}
DPRINT(MAX_TRACE, ("Deleting file: '%s'\n", CurNode->FileName));
TotalFileSize -= (sizeof(CFFILE) + (ULONG)strlen(GetFileName(CurNode->FileName)) + 1);
if (CurNode->FileName)
FreeMemory(CurNode->FileName);
FreeMemory(CurNode);
}
CurNode = NextNode;
}
} | false | false | false | false | false | 0 |
argos(block)
Block *block;
{
int width, pos, seq, seq1, seqs, diff[MAXROWS][MAXROWS];
double total;
width = block->sequences[0].length;
if (width > EXTRA_LARGE_BUFF)
{
width = EXTRA_LARGE_BUFF;
fprintf(stderr, "ERROR: Block %s is too wide (%d), truncated to %d\n",
block->number, block->sequences[0].length, width);
}
seqs = block->num_sequences;
if (seqs > MAXROWS)
{
seqs = MAXROWS;
fprintf(stderr,"ERROR: Block %s is too deep (%d), truncated to %d sequences\n",
block->number, block->num_sequences, seqs);
}
for (seq = 0; seq < seqs; seq++)
for (seq1 = 0; seq1 < seqs; seq1++)
diff[seq][seq1] = 0;
for (seq = 0; seq < seqs; seq++)
for (seq1 = 0; seq1 < seqs; seq1++)
for (pos = 0; pos < width; pos++)
if (block->residues[seq][pos] !=
block->residues[seq1][pos])
diff[seq][seq1] = diff[seq][seq1] + 1;
total = 0.0;
for (seq = 0; seq < seqs; seq++)
block->sequences[seq].weight = 0.0;
for (seq = 0; seq < seqs; seq++)
for (seq1 = 0; seq1 < seqs; seq1++)
{
block->sequences[seq].weight += (double) diff[seq][seq1];
total += (double) diff[seq][seq1];
}
for (seq = 0; seq < seqs; seq++)
{
block->sequences[seq].weight /= total;
}
} | false | false | false | false | false | 0 |
gpio_trig_brightness_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t n)
{
struct led_classdev *led = dev_get_drvdata(dev);
struct gpio_trig_data *gpio_data = led->trigger_data;
unsigned desired_brightness;
int ret;
ret = sscanf(buf, "%u", &desired_brightness);
if (ret < 1 || desired_brightness > 255) {
dev_err(dev, "invalid value\n");
return -EINVAL;
}
gpio_data->desired_brightness = desired_brightness;
return n;
} | false | false | false | false | false | 0 |
vm_delta_from_interp_angle( float current_angle, float desired_angle )
{
float delta;
if ( desired_angle < 0.0f ) desired_angle += PI2;
if ( desired_angle > PI2 ) desired_angle -= PI2;
delta = desired_angle - current_angle;
if ( fl_abs(delta) > PI ) {
if ( delta > 0.0f ) {
delta = delta - PI2;
} else {
delta = PI2 - delta;
}
}
return delta;
} | false | false | false | false | false | 0 |
SB_Ticker(void)
{
int delta;
int curHealth;
curHealth = players[consoleplayer].mo->health;
if (curHealth < 0)
{
curHealth = 0;
}
if (curHealth < HealthMarker)
{
delta = (HealthMarker - curHealth) >> 2;
if (delta < 1)
{
delta = 1;
}
else if (delta > 6)
{
delta = 6;
}
HealthMarker -= delta;
}
else if (curHealth > HealthMarker)
{
delta = (curHealth - HealthMarker) >> 2;
if (delta < 1)
{
delta = 1;
}
else if (delta > 6)
{
delta = 6;
}
HealthMarker += delta;
}
} | false | false | false | false | false | 0 |
fort_read_line(FILE *fp, gchar **line)
{
gint ret_val;
gchar the_line[LINELEN];
ret_val = fgetline(fp, the_line);
if (!ret_val)
{
*line = g_strndup(the_line, 80);
}
return(ret_val);
} | false | false | false | false | false | 0 |
DateCalc_ISO_UC(N_char c)
{
N_int i = (N_int) c;
if (((i >= 0x61) and (i <= 0x7A)) or
((i >= 0xE0) and (i <= 0xF6)) or
((i >= 0xF8) and (c <= 0xFE))) i -= 0x20;
return((N_char) i);
} | false | false | false | false | false | 0 |
renderGradient(const FbTk::Texture &texture) {
bool inverted = false;
using namespace FbTk;
interlaced = texture.type() & Texture::INTERLACED;
if (texture.type() & Texture::SUNKEN) {
from = &(texture.colorTo());
to = &(texture.color());
if (! (texture.type() & Texture::INVERT))
inverted = true;
} else {
from = &(texture.color());
to = &(texture.colorTo());
if (texture.type() & Texture::INVERT)
inverted = true;
}
control.getGradientBuffers(width, height, &xtable, &ytable);
if (texture.type() & Texture::DIAGONAL)
dgradient();
else if (texture.type() & Texture::ELLIPTIC)
egradient();
else if (texture.type() & Texture::HORIZONTAL)
hgradient();
else if (texture.type() & Texture::PYRAMID)
pgradient();
else if (texture.type() & Texture::RECTANGLE)
rgradient();
else if (texture.type() & Texture::VERTICAL)
vgradient();
else if (texture.type() & Texture::CROSSDIAGONAL)
cdgradient();
else if (texture.type() & Texture::PIPECROSS)
pcgradient();
if (texture.type() & Texture::BEVEL1)
bevel1();
else if (texture.type() & Texture::BEVEL2)
bevel2();
if (inverted)
invert();
return renderPixmap();
} | false | false | false | false | false | 0 |
vscb_pref_cb( FL_OBJECT * ob,
long data FL_UNUSED_ARG )
{
FD_browserattrib *ui = ob->form->fdui;
int i = fl_get_choice( ob );
fl_set_browser_vscrollbar( ui->vdata, i - 1 );
if ( auto_apply )
redraw_the_form( 0 );
} | false | false | false | false | false | 0 |
gmpc_tools_metadata_appearance_real_preferences_pane_destroy (GmpcPluginPreferencesIface* base, GtkContainer* container) {
GmpcToolsMetadataAppearance * self;
GtkContainer* _tmp0_;
GList* _tmp1_ = NULL;
self = (GmpcToolsMetadataAppearance*) base;
g_return_if_fail (container != NULL);
_tmp0_ = container;
_tmp1_ = gtk_container_get_children (_tmp0_);
{
GList* child_collection = NULL;
GList* child_it = NULL;
child_collection = _tmp1_;
for (child_it = child_collection; child_it != NULL; child_it = child_it->next) {
GtkWidget* _tmp2_;
GtkWidget* child = NULL;
_tmp2_ = _g_object_ref0 ((GtkWidget*) child_it->data);
child = _tmp2_;
{
GtkContainer* _tmp3_;
GtkWidget* _tmp4_;
_tmp3_ = container;
_tmp4_ = child;
gtk_container_remove (_tmp3_, _tmp4_);
_g_object_unref0 (child);
}
}
_g_list_free0 (child_collection);
}
} | false | false | false | false | false | 0 |
gx_unit_frac(float fvalue)
{
frac f = frac_0;
if (is_fneg(fvalue))
f = frac_0;
else if (is_fge1(fvalue))
f = frac_1;
else
f = float2frac(fvalue);
return f;
} | false | false | false | false | false | 0 |
sharedlibs_clear (Sharedlibs *sl)
{
g_return_if_fail (sl->widgets.store != NULL);
g_return_if_fail (GTK_IS_LIST_STORE (sl->widgets.store));
gtk_list_store_clear (sl->widgets.store);
} | false | false | false | false | false | 0 |
similarity( const QString &s1, const QString &s2 )
{
const size_t len1 = s1.length(), len2 = s2.length();
QVector<uint> col( len2 + 1 ), prevCol( len2 + 1 );
for( uint i = 0; i <= len2; i++ )
prevCol[i] = i;
for( uint i = 0; i < len1; i++ )
{
col[0] = i + 1;
for( uint j = 0; j < len2; j++ )
col[j + 1] = qMin( qMin( 1 + col[j], 1 + prevCol[1 + j] ),
prevCol[j] + ( s1[i] == s2[j] ? 0 : 1 ) );
col.swap( prevCol );
}
return 1.0 - ( float )prevCol[len2] / ( len1 + len2 );
} | false | false | false | false | false | 0 |
get_byte(s)
gz_stream *s;
{
if (s->z_eof) return EOF;
if (s->stream.avail_in == 0) {
errno = 0;
s->stream.avail_in = (uInt)fread(s->inbuf, 1, Z_BUFSIZE, s->file);
if (s->stream.avail_in == 0) {
s->z_eof = 1;
/* klibc hack */
if (errno) s->z_err = Z_ERRNO;
return EOF;
}
s->stream.next_in = s->inbuf;
}
s->stream.avail_in--;
return *(s->stream.next_in)++;
} | false | false | false | false | false | 0 |
be_isr(int irq, void *dev_id)
{
struct beiscsi_hba *phba;
struct hwi_controller *phwi_ctrlr;
struct hwi_context_memory *phwi_context;
struct be_eq_entry *eqe = NULL;
struct be_queue_info *eq;
struct be_queue_info *mcc;
unsigned long flags, index;
unsigned int num_mcceq_processed, num_ioeq_processed;
struct be_ctrl_info *ctrl;
struct be_eq_obj *pbe_eq;
int isr;
phba = dev_id;
ctrl = &phba->ctrl;
isr = ioread32(ctrl->csr + CEV_ISR0_OFFSET +
(PCI_FUNC(ctrl->pdev->devfn) * CEV_ISR_SIZE));
if (!isr)
return IRQ_NONE;
phwi_ctrlr = phba->phwi_ctrlr;
phwi_context = phwi_ctrlr->phwi_ctxt;
pbe_eq = &phwi_context->be_eq[0];
eq = &phwi_context->be_eq[0].q;
mcc = &phba->ctrl.mcc_obj.cq;
index = 0;
eqe = queue_tail_node(eq);
num_ioeq_processed = 0;
num_mcceq_processed = 0;
while (eqe->dw[offsetof(struct amap_eq_entry, valid) / 32]
& EQE_VALID_MASK) {
if (((eqe->dw[offsetof(struct amap_eq_entry,
resource_id) / 32] &
EQE_RESID_MASK) >> 16) == mcc->id) {
spin_lock_irqsave(&phba->isr_lock, flags);
pbe_eq->todo_mcc_cq = true;
spin_unlock_irqrestore(&phba->isr_lock, flags);
num_mcceq_processed++;
} else {
if (!blk_iopoll_sched_prep(&pbe_eq->iopoll))
blk_iopoll_sched(&pbe_eq->iopoll);
num_ioeq_processed++;
}
AMAP_SET_BITS(struct amap_eq_entry, valid, eqe, 0);
queue_tail_inc(eq);
eqe = queue_tail_node(eq);
}
if (num_ioeq_processed || num_mcceq_processed) {
if (pbe_eq->todo_mcc_cq)
queue_work(phba->wq, &pbe_eq->work_cqs);
if ((num_mcceq_processed) && (!num_ioeq_processed))
hwi_ring_eq_db(phba, eq->id, 0,
(num_ioeq_processed +
num_mcceq_processed) , 1, 1);
else
hwi_ring_eq_db(phba, eq->id, 0,
(num_ioeq_processed +
num_mcceq_processed), 0, 1);
return IRQ_HANDLED;
} else
return IRQ_NONE;
} | false | false | false | false | false | 0 |
sse4_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h)
{
int s, i;
uint32_t *sq = ff_squareTbl + 256;
s = 0;
for (i = 0; i < h; i++) {
s += sq[pix1[0] - pix2[0]];
s += sq[pix1[1] - pix2[1]];
s += sq[pix1[2] - pix2[2]];
s += sq[pix1[3] - pix2[3]];
pix1 += line_size;
pix2 += line_size;
}
return s;
} | false | false | false | false | false | 0 |
gth_file_store_iter_parent (GtkTreeModel *tree_model,
GtkTreeIter *iter,
GtkTreeIter *child)
{
GthFileStore *file_store;
g_return_val_if_fail (child == NULL, FALSE);
file_store = (GthFileStore *) tree_model;
g_return_val_if_fail (VALID_ITER (child, file_store), FALSE);
return FALSE;
} | false | false | false | false | false | 0 |
ajTrnSeqC(const AjPTrn trnObj, const char *str, ajint len, AjPStr *pep)
{
ajint i;
ajint lenmod3;
const char *cp = str;
AjPStr transtr = NULL;
char *cq;
ajint trnlen;
lenmod3 = len - (len % 3);
trnlen = lenmod3/3;
transtr = ajStrNewRes(trnlen+1);
cq = ajStrGetuniquePtr(&transtr);
for(i=0; i < lenmod3; i+=3)
{
*cq++ = trnObj->GC[trnconv[(ajint)*cp]]
[trnconv[(ajint)*(cp+1)]]
[trnconv[(ajint)*(cp+2)]];
cp+=3;
}
ajStrSetValidLen(&transtr, trnlen);
ajStrAppendS(pep, transtr);
ajStrDel(&transtr);
return;
} | false | false | false | false | false | 0 |
fill_from_channel (MsgChannel *c)
{
if (IS_PROTOCOL_29(c)) {
Msg::fill_from_channel(c);
*c >> filename;
uint32_t _lang;
*c >> _lang;
lang = static_cast<CompileJob::Language>(_lang);
}
else
GetCSMsg::fill_from_channel (c);
*c >> job_id;
*c >> clientid;
} | false | false | false | false | false | 0 |
main(int argc, char **argv) {
int i;
tabsize = 0; /* default for nt is not to use tabs */
progname = argv[0];
finalstage = 1;
#line 46 "mnt.nw"
read_defs(stdin);
apply_each_module(remove_final_newline);
#line 36 "mnt.nw"
for (i=1; i<argc; i++)
switch (*argv[i]) {
case '-':
#line 152 "mnt.nw"
switch (*++argv[i]) {
case 'a':
if (strcmp(argv[i], "all"))
errormsg(Warning, "Ignoring unknown option -%s", argv[i]);
else {
#line 49 "mnt.nw"
apply_each_module(add_uses_to_usecounts);
apply_each_module(emit_if_unused_and_conforming);
#line 156 "mnt.nw"
}
break;
case 't': /* set tab size or turn off */
if (isdigit(argv[i][1]))
tabsize = atoi(argv[i]+1);
else if (argv[i][1]==0)
tabsize = 0; /* no tabs */
else
errormsg(Error, "%s: ill-formed option %s\n", argv[0], argv[i]);
break;
case 'L': /* have a #line number format */
locformat = argv[i] + 1;
if (!*locformat) locformat = Clocformat;
break;
default:
errormsg(Warning, "Ignoring unknown option -%s", argv[i]);
}
#line 38 "mnt.nw"
break;
default: emitfile(argv[i]); break;
}
nowebexit(NULL);
return errorlevel; /* slay warning */
} | false | false | false | false | false | 0 |
IPrcWrite(pfPrcHelper* prc) {
prc->startTag("SpaceTreeParams");
prc->writeParam("Root", fRoot);
prc->writeParam("NumLeaves", fNumLeaves);
prc->endTag(true);
prc->writeSimpleTag("Tree");
for (size_t i=0; i<fTree.getSize(); i++)
fTree[i].prcWrite(prc);
prc->closeTag();
} | false | false | false | false | false | 0 |
restore_snapshot(idx, close_curwin)
int idx;
int close_curwin; /* closing current window */
{
win_T *wp;
if (curtab->tp_snapshot[idx] != NULL
# ifdef FEAT_VERTSPLIT
&& curtab->tp_snapshot[idx]->fr_width == topframe->fr_width
# endif
&& curtab->tp_snapshot[idx]->fr_height == topframe->fr_height
&& check_snapshot_rec(curtab->tp_snapshot[idx], topframe) == OK)
{
wp = restore_snapshot_rec(curtab->tp_snapshot[idx], topframe);
win_comp_pos();
if (wp != NULL && close_curwin)
win_goto(wp);
redraw_all_later(CLEAR);
}
clear_snapshot(curtab, idx);
} | false | false | false | false | false | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.