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 |
|---|---|---|---|---|---|---|
gretl_print_get_chunk (PRN *prn)
{
char *buf;
if (prn == NULL || prn->buf == NULL ||
prn->savepos < 0 || prn->savepos > strlen(prn->buf)) {
return NULL;
}
buf = gretl_strdup(prn->buf + prn->savepos);
prn->savepos = -1;
return buf;
} | false | false | false | false | false | 0 |
process(ast_procdef* p) {
gps_opt_edge_iteration_t T;
p->traverse_post(&T);
if (T.has_targets())
T.post_process();
} | false | false | false | false | false | 0 |
mlx4_en_stamp_wqe(struct mlx4_en_priv *priv,
struct mlx4_en_tx_ring *ring, int index,
u8 owner)
{
__be32 stamp = cpu_to_be32(STAMP_VAL | (!!owner << STAMP_SHIFT));
struct mlx4_en_tx_desc *tx_desc = ring->buf + index * TXBB_SIZE;
struct mlx4_en_tx_info *tx_info = &ring->tx_info[index];
void *end = ring->buf + ring->buf_size;
__be32 *ptr = (__be32 *)tx_desc;
int i;
/* Optimize the common case when there are no wraparounds */
if (likely((void *)tx_desc + tx_info->nr_txbb * TXBB_SIZE <= end)) {
/* Stamp the freed descriptor */
for (i = 0; i < tx_info->nr_txbb * TXBB_SIZE;
i += STAMP_STRIDE) {
*ptr = stamp;
ptr += STAMP_DWORDS;
}
} else {
/* Stamp the freed descriptor */
for (i = 0; i < tx_info->nr_txbb * TXBB_SIZE;
i += STAMP_STRIDE) {
*ptr = stamp;
ptr += STAMP_DWORDS;
if ((void *)ptr >= end) {
ptr = ring->buf;
stamp ^= cpu_to_be32(0x80000000);
}
}
}
} | false | false | false | false | false | 0 |
fsbe_write_pe_statement_item_hook(cx, sp, p)
fsbe_context *cx;
Pe_statement *sp;
Statement *p;
{
Block *current_bp = sp->block;
int pe_no = ompfbe_current_pe_number_in_cluster_from_pe_statement(sp);
if (current_bp->usage == USE_EMT
|| ompfbe_is_shared_loop_body(sp->block)
|| sp->vpe_no == pe_no) {
return 0;
} else {
return 1;
}
} | false | false | false | false | false | 0 |
reservation_object_get_fences_rcu(struct reservation_object *obj,
struct fence **pfence_excl,
unsigned *pshared_count,
struct fence ***pshared)
{
unsigned shared_count = 0;
unsigned retry = 1;
struct fence **shared = NULL, *fence_excl = NULL;
int ret = 0;
while (retry) {
struct reservation_object_list *fobj;
unsigned seq;
seq = read_seqcount_begin(&obj->seq);
rcu_read_lock();
fobj = rcu_dereference(obj->fence);
if (fobj) {
struct fence **nshared;
size_t sz = sizeof(*shared) * fobj->shared_max;
nshared = krealloc(shared, sz,
GFP_NOWAIT | __GFP_NOWARN);
if (!nshared) {
rcu_read_unlock();
nshared = krealloc(shared, sz, GFP_KERNEL);
if (nshared) {
shared = nshared;
continue;
}
ret = -ENOMEM;
shared_count = 0;
break;
}
shared = nshared;
memcpy(shared, fobj->shared, sz);
shared_count = fobj->shared_count;
} else
shared_count = 0;
fence_excl = rcu_dereference(obj->fence_excl);
retry = read_seqcount_retry(&obj->seq, seq);
if (retry)
goto unlock;
if (!fence_excl || fence_get_rcu(fence_excl)) {
unsigned i;
for (i = 0; i < shared_count; ++i) {
if (fence_get_rcu(shared[i]))
continue;
/* uh oh, refcount failed, abort and retry */
while (i--)
fence_put(shared[i]);
if (fence_excl) {
fence_put(fence_excl);
fence_excl = NULL;
}
retry = 1;
break;
}
} else
retry = 1;
unlock:
rcu_read_unlock();
}
*pshared_count = shared_count;
if (shared_count)
*pshared = shared;
else {
*pshared = NULL;
kfree(shared);
}
*pfence_excl = fence_excl;
return ret;
} | false | false | false | false | false | 0 |
out( MifOutputByteStream &os,
unsigned properties,
FontStatement fontStatement ) {
const char *statementName = (fontStatement == stPgfFont) ? "PgfFont" : "Font";
if( properties ) {
os << '\n' << MifOutputByteStream::INDENT << "<" << statementName << " ";
os.indent();
PROPERTY_OUT( FFamily );
PROPERTY_OUT( FAngle );
PROPERTY_OUT( FWeight );
PROPERTY_OUT( FVar );
PROPERTY_OUT( FSize );
PROPERTY_OUT( FColor );
PROPERTY_OUT( FUnderlining );
PROPERTY_OUT( FOverline );
PROPERTY_OUT( FStrike );
PROPERTY_OUT( FPosition );
PROPERTY_OUT( FPairKern );
PROPERTY_OUT( FCase );
PROPERTY_OUT( FDX );
PROPERTY_OUT( FDY );
PROPERTY_OUT( FDW );
os.undent();
os << '\n' << MifOutputByteStream::INDENT << ">";
}
} | false | false | false | false | false | 0 |
ioctlcallback(CURL *handle,
int cmd,
void *clientp)
{
int *counter = (int *)clientp;
(void)handle; /* unused */
if(cmd == CURLIOCMD_RESTARTREAD) {
fprintf(stderr, "REWIND!\n");
*counter = 0; /* clear counter to make the read callback restart */
}
return CURLIOE_OK;
} | false | false | false | false | false | 0 |
get_user_func_name(xp, idx)
expand_T *xp;
int idx;
{
static long_u done;
static hashitem_T *hi;
ufunc_T *fp;
if (idx == 0)
{
done = 0;
hi = func_hashtab.ht_array;
}
if (done < func_hashtab.ht_used)
{
if (done++ > 0)
++hi;
while (HASHITEM_EMPTY(hi))
++hi;
fp = HI2UF(hi);
if (STRLEN(fp->uf_name) + 4 >= IOSIZE)
return fp->uf_name; /* prevents overflow */
cat_func_name(IObuff, fp);
if (xp->xp_context != EXPAND_USER_FUNC)
{
STRCAT(IObuff, "(");
if (!fp->uf_varargs && fp->uf_args.ga_len == 0)
STRCAT(IObuff, ")");
}
return IObuff;
}
return NULL;
} | false | false | false | true | false | 1 |
has_modal_parent() const
{
CL_GUIManager *gui = get_gui_manager();
if (gui != NULL)
{
if (impl->parent)
if (impl->parent == gui->get_modal_component())
return true;
else
return impl->parent->has_modal_parent();
}
return false;
} | false | false | false | false | false | 0 |
cb_build_perform_once (cb_tree body)
{
cb_tree x;
if (body == cb_error_node) {
return cb_error_node;
}
x = cb_build_perform (CB_PERFORM_ONCE);
CB_PERFORM (x)->body = body;
return x;
} | false | false | false | true | false | 1 |
syn_cmd_reset(eap, syncing)
exarg_T *eap;
int syncing UNUSED;
{
eap->nextcmd = check_nextcmd(eap->arg);
if (!eap->skip)
{
set_internal_string_var((char_u *)"syntax_cmd", (char_u *)"reset");
do_cmdline_cmd((char_u *)"runtime! syntax/syncolor.vim");
do_unlet((char_u *)"g:syntax_cmd", TRUE);
}
} | false | false | false | false | false | 0 |
save_to_buffer_thread (GSimpleAsyncResult *result,
GObject *object,
GCancellable *cancellable)
{
SaveArguments *arguments;
GthImageSaveData *data;
GError *error = NULL;
arguments = g_simple_async_result_get_op_res_gpointer (result);
data = _gth_image_save_to_buffer_common (arguments->image,
arguments->mime_type,
arguments->file_data,
cancellable,
&error);
if (data != NULL)
g_simple_async_result_set_op_res_gpointer (result, data, NULL);
else
g_simple_async_result_take_error (result, error);
} | false | false | false | false | false | 0 |
StartButtonInit(int height)
{
FvwmPicture *p = NULL;
int pw;
FvwmPictureAttributes fpa;
StartAndLaunchButtonItem *tempPtr;
fpa.mask = FPAM_NO_ALLOC_PIXELS;
/* if no start button params were specified, trick the program into
* thinking that they were */
if (First_Start_Button == NULL && !NoDefaultStartButton)
{
StartButtonParseConfig("*FvwmTaskBarStartName Start");
StartButtonParseConfig("*FvwmTaskBarStartMenu RootMenu");
StartButtonParseConfig("*FvwmTaskBarStartIcon mini.start.xpm");
}
/* some defaults */
if (First_Start_Button && First_Start_Button->isStartButton == True)
{
if (First_Start_Button->buttonCaption == NULL)
UpdateString(&(First_Start_Button->buttonCaption), "Start");
if (First_Start_Button->buttonIconFileName == NULL)
UpdateString(&(First_Start_Button->buttonIconFileName), "mini-start.xpm");
}
tempPtr = First_Start_Button;
while(tempPtr != NULL)
{
p = PGetFvwmPicture(
dpy, win, ImagePath, tempPtr->buttonIconFileName, fpa);
if (p != NULL && strlen(tempPtr->buttonCaption) != 0)
{
/* icon and title */
pw = p->width + 12;
}
else if (p != NULL)
{
/* just icon */
pw = p->width + 8;
}
else
{
/* just title */
pw = 10;
}
tempPtr->buttonItem = (Button *)ButtonNew(
tempPtr->buttonCaption, p, BUTTON_UP,0);
if (tempPtr->isStartButton)
{
StartButton = tempPtr->buttonItem;
tempPtr->width = FlocaleTextWidth(
FSelButtonFont, tempPtr->buttonCaption,
strlen(tempPtr->buttonCaption)) + pw;
}
else
{
tempPtr->width = FlocaleTextWidth(
FButtonFont, tempPtr->buttonCaption,
strlen(tempPtr->buttonCaption)) + pw;
}
tempPtr->height = height;
StartAndLaunchButtonsWidth += tempPtr->width;
tempPtr=tempPtr->tail;
PFreeFvwmPictureData(p); /* should not destroy of course */
}
if (First_Start_Button)
{
StartAndLaunchButtonsWidth += StartButtonRightMargin;
First_Start_Button->height = height;
StartAndLaunchButtonsHeight = First_Start_Button->height;
}
else
{
StartAndLaunchButtonsWidth = 0;
StartButtonRightMargin = 0;
if (has_wb_left_margin == 0)
{
WindowButtonsLeftMargin = 0;
}
if (has_wb_right_margin == 0)
{
WindowButtonsRightMargin = 0;
}
}
} | false | false | false | false | true | 1 |
load(ifstream & fp){
size_t r = loadValue<size_t>(fp);
size_t pos = fp.tellg();
fp.seekg(pos-sizeof(size_t));
cout << "Loading "<< r << endl;
switch(r) {
case CSTY: return SuffixTreeY::load(fp);
}
return NULL;
} | false | false | false | false | false | 0 |
get_kungfum_bg_tile_info( int offs )
{
int code;
int color;
int flags;
code = m62_tileram[ offs ];
color = m62_tileram[ offs + 0x800 ];
flags = 0;
if( ( color & 0x20 ) )
{
flags |= TILE_FLIPX;
}
SET_TILE_INFO( 0, code | ( ( color & 0xc0 ) << 2 ), color & 0x1f, flags );
/* is the following right? */
if( ( offs / 64 ) < 6 || ( ( color & 0x1f ) >> 1 ) > 0x0c )
{
tile_info.priority = 1;
}
else
{
tile_info.priority = 0;
}
} | false | false | false | false | false | 0 |
semantic_type_new (uniqstr tag, const location *loc)
{
semantic_type *res = xmalloc (sizeof *res);
uniqstr_assert (tag);
res->tag = tag;
res->location = loc ? *loc : empty_location;
res->status = undeclared;
{
int i;
for (i = 0; i < CODE_PROPS_SIZE; ++i)
code_props_none_init (&res->props[i]);
}
return res;
} | false | false | false | false | false | 0 |
TRANS_mid()
{
PATTERN *str;
PATTERN *pos;
PATTERN *len;
PATTERN *save;
TRANS_want(RS_LBRA, "Left bracket");
str = JOB->current;
TRANS_expression(FALSE);
TRANS_want(RS_COMMA, "Comma");
pos = JOB->current;
TRANS_expression(FALSE);
CODE_push_number(1);
CODE_op(C_SUB, 0, 2, TRUE);
TRANS_subr(TS_SUBR_LEFT, 2);
if (TRANS_is(RS_COMMA))
{
len = JOB->current;
TRANS_ignore_expression();
}
else
{
len = NULL;
}
TRANS_want(RS_RBRA, "Right bracket");
TRANS_want(RS_EQUAL, "Equal");
TRANS_expression(FALSE);
save = JOB->current;
if (len)
{
JOB->current = str;
TRANS_expression(FALSE);
JOB->current = pos;
TRANS_expression(FALSE);
JOB->current = len;
TRANS_expression(FALSE);
CODE_op(C_ADD, 0, 2, TRUE);
TRANS_subr(TS_SUBR_MID, 2);
}
CODE_op(C_CAT, 0, len ? 3 : 2, FALSE);
JOB->current = str;
TRANS_reference();
JOB->current = save;
} | false | false | false | false | false | 0 |
vpn_provider_new(void)
{
struct vpn_provider *provider;
provider = g_try_new0(struct vpn_provider, 1);
if (provider == NULL)
return NULL;
provider->refcount = 1;
DBG("provider %p", provider);
provider_initialize(provider);
return provider;
} | false | false | false | false | false | 0 |
GetSortOrders (OrderMaker &left, OrderMaker &right) {
// initialize the size of the OrderMakers
left.numAtts = 0;
right.numAtts = 0;
// loop through all of the disjunctions in the CNF and find those
// that are acceptable for use in a sort ordering
for (int i = 0; i < numAnds; i++) {
// if we don't have a disjunction of length one, then it
// can't be acceptable for use with a sort ordering
if (orLens[i] != 1) {
continue;
}
// made it this far, so first verify that it is an equality check
if (orList[i][0].op != Equals) {
continue;
}
// now verify that it operates over atts from both tables
if (!((orList[i][0].operand1 == Left && orList[i][0].operand2 == Right) ||
(orList[i][0].operand2 == Left && orList[i][0].operand1 == Right))) {
//continue;
}
// since we are here, we have found a join attribute!!!
// so all we need to do is add the new comparison info into the
// relevant structures
if (orList[i][0].operand1 == Left) {
left.whichAtts[left.numAtts] = orList[i][0].whichAtt1;
left.whichTypes[left.numAtts] = orList[i][0].attType;
}
if (orList[i][0].operand1 == Right) {
right.whichAtts[right.numAtts] = orList[i][0].whichAtt1;
right.whichTypes[right.numAtts] = orList[i][0].attType;
}
if (orList[i][0].operand2 == Left) {
left.whichAtts[left.numAtts] = orList[i][0].whichAtt2;
left.whichTypes[left.numAtts] = orList[i][0].attType;
}
if (orList[i][0].operand2 == Right) {
right.whichAtts[right.numAtts] = orList[i][0].whichAtt2;
right.whichTypes[right.numAtts] = orList[i][0].attType;
}
// note that we have found two new attributes
left.numAtts++;
right.numAtts++;
}
return left.numAtts;
} | false | false | false | false | false | 0 |
unity_filter_set_model_and_iter (UnityFilter* self, DeeModel* model, DeeModelIter* iter) {
DeeModel* _tmp0_ = NULL;
DeeModel* _tmp1_ = NULL;
DeeModelIter* _tmp2_ = NULL;
DeeModel* _tmp3_ = NULL;
DeeModel* _tmp4_ = NULL;
DeeModelIter* _tmp5_ = NULL;
g_return_if_fail (self != NULL);
g_return_if_fail (model != NULL);
g_return_if_fail (iter != NULL);
_tmp0_ = model;
_tmp1_ = _g_object_ref0 (_tmp0_);
_g_object_unref0 (self->priv->_model);
self->priv->_model = _tmp1_;
_tmp2_ = iter;
self->priv->_iter = _tmp2_;
_tmp3_ = self->priv->_model;
g_signal_connect_object (_tmp3_, "row-changed", (GCallback) _unity_filter_on_row_changed_dee_model_row_changed, self, 0);
_tmp4_ = model;
_tmp5_ = iter;
unity_filter_on_row_changed (self, _tmp4_, _tmp5_);
} | false | false | false | false | false | 0 |
CERT_FindCertByIssuerAndSN(CERTCertDBHandle *handle, CERTIssuerAndSN *issuerAndSN)
{
PK11SlotInfo *slot;
CERTCertificate *cert;
cert = PK11_FindCertByIssuerAndSN(&slot,issuerAndSN,NULL);
if (cert && slot) {
PK11_FreeSlot(slot);
}
return cert;
} | false | false | false | false | false | 0 |
listen(const std::string& ip, unsigned short int port, int backlog)
{
log_info("listen ip=" << ip << " port=" << port);
_impl->listen(ip, port, backlog);
} | false | false | false | false | false | 0 |
sbs_get_property_index(struct i2c_client *client,
enum power_supply_property psp)
{
int count;
for (count = 0; count < ARRAY_SIZE(sbs_data); count++)
if (psp == sbs_data[count].psp)
return count;
dev_warn(&client->dev,
"%s: Invalid Property - %d\n", __func__, psp);
return -EINVAL;
} | false | false | false | false | false | 0 |
plugin_print_lists(void)
{
int i;
struct slapdplugin *list = NULL;
struct slapdplugin *tmp = NULL;
for (i = 0; i < PLUGIN_LIST_GLOBAL_MAX; i++) {
if ((list = get_plugin_list(i)))
{
slapi_log_error(SLAPI_LOG_PLUGIN, NULL,
"---- Plugin List (type %d) ----\n", i);
for ( tmp = list; tmp; tmp = tmp->plg_next )
{
slapi_log_error(SLAPI_LOG_PLUGIN, NULL, " %s (precedence: %d)\n",
tmp->plg_name, tmp->plg_precedence);
}
}
}
} | false | false | false | false | false | 0 |
GlobalizeReference(i::Object** obj) {
if (IsDeadCheck("V8::Persistent::New")) return NULL;
LOG_API("Persistent::New");
i::Handle<i::Object> result =
i::GlobalHandles::Create(*obj);
return result.location();
} | false | false | false | false | false | 0 |
xol_free_insn_slot(struct task_struct *tsk)
{
struct xol_area *area;
unsigned long vma_end;
unsigned long slot_addr;
if (!tsk->mm || !tsk->mm->uprobes_state.xol_area || !tsk->utask)
return;
slot_addr = tsk->utask->xol_vaddr;
if (unlikely(!slot_addr))
return;
area = tsk->mm->uprobes_state.xol_area;
vma_end = area->vaddr + PAGE_SIZE;
if (area->vaddr <= slot_addr && slot_addr < vma_end) {
unsigned long offset;
int slot_nr;
offset = slot_addr - area->vaddr;
slot_nr = offset / UPROBE_XOL_SLOT_BYTES;
if (slot_nr >= UINSNS_PER_PAGE)
return;
clear_bit(slot_nr, area->bitmap);
atomic_dec(&area->slot_count);
smp_mb__after_atomic(); /* pairs with prepare_to_wait() */
if (waitqueue_active(&area->wq))
wake_up(&area->wq);
tsk->utask->xol_vaddr = 0;
}
} | false | false | false | false | false | 0 |
insert_table (CTL_MSG * request, CTL_RESPONSE * response)
{
table_t *ptr;
ptr = malloc (sizeof *ptr);
if (!ptr)
{
syslog (LOG_ERR, "Out of memory");
exit (EXIT_FAILURE);
}
request->id_num = new_id ();
if (debug)
print_request ("insert_table", request);
response->id_num = htonl (request->id_num);
time (&ptr->time);
ptr->request = *request;
ptr->prev = NULL;
ptr->next = table;
table = ptr;
return 0;
} | false | false | false | false | false | 0 |
g3d_vector_transform(G3DVector *x, G3DVector *y, G3DVector *z,
G3DMatrix *matrix)
{
G3DVector vector[4], result[4];
guint32 i, k;
vector[0] = *x;
vector[1] = *y;
vector[2] = *z;
vector[3] = 1.0;
for(i = 0; i < 4; i ++) {
result[i] = 0.0;
for(k = 0; k < 4; k ++)
#if 0
result[i] += matrix[i * 4 + k] * vector[k];
#else
result[i] += matrix[k * 4 + i] * vector[k];
#endif
}
*x = result[0];
*y = result[1];
*z = result[2];
return TRUE;
} | false | false | false | false | false | 0 |
gconf_notifier_wrapper_trigger (G_GNUC_UNUSED GConfClient *client_,
guint identifier,
GConfEntry *entry,
gpointer user_data)
{
GConfNotifierWrap *wrapper = NULL;
g_return_if_fail (user_data != NULL);
wrapper = (GConfNotifierWrap *)user_data;
wrapper->real_notifier (GUINT_TO_POINTER (identifier),
(GmConfEntry *)entry,
wrapper->real_user_data);
} | false | false | false | false | false | 0 |
aim_tx_completion(struct most_interface *iface, int channel_id)
{
struct aim_channel *channel;
if (!iface) {
pr_info("Bad interface pointer\n");
return -EINVAL;
}
if ((channel_id < 0) || (channel_id >= iface->num_channels)) {
pr_info("Channel ID out of range\n");
return -EINVAL;
}
channel = get_channel(iface, channel_id);
if (!channel)
return -ENXIO;
wake_up_interruptible(&channel->wq);
return 0;
} | false | false | false | false | false | 0 |
isl_ast_node_alloc(isl_ctx *ctx,
enum isl_ast_node_type type)
{
isl_ast_node *node;
node = isl_calloc_type(ctx, isl_ast_node);
if (!node)
return NULL;
node->ctx = ctx;
isl_ctx_ref(ctx);
node->ref = 1;
node->type = type;
return node;
} | false | false | false | false | false | 0 |
reference_create(
git_reference **ref_out,
git_repository *repo,
const char *name,
git_rtype type)
{
char normalized[MAX_GITDIR_TREE_STRUCTURE_PATH_LENGTH];
int error = GIT_SUCCESS, size;
git_reference *reference = NULL;
assert(ref_out && repo && name);
if (type == GIT_REF_SYMBOLIC)
size = sizeof(reference_symbolic);
else if (type == GIT_REF_OID)
size = sizeof(reference_oid);
else
return GIT_EINVALIDREFSTATE;
reference = git__malloc(size);
if (reference == NULL)
return GIT_ENOMEM;
memset(reference, 0x0, size);
reference->owner = repo;
reference->type = type;
error = normalize_name(normalized, name, (type & GIT_REF_OID));
if (error < GIT_SUCCESS)
goto cleanup;
reference->name = git__strdup(normalized);
if (reference->name == NULL) {
error = GIT_ENOMEM;
goto cleanup;
}
*ref_out = reference;
return error;
cleanup:
reference_free(reference);
return error;
} | true | true | false | false | true | 1 |
test_empty (hb_set_t *s)
{
hb_codepoint_t next = HB_SET_VALUE_INVALID;
g_assert_cmpint (hb_set_get_population (s), ==, 0);
g_assert_cmpint (hb_set_get_min (s), ==, HB_SET_VALUE_INVALID);
g_assert_cmpint (hb_set_get_max (s), ==, HB_SET_VALUE_INVALID);
g_assert (!hb_set_has (s, 13));
g_assert (!hb_set_next (s, &next));
g_assert_cmpint (next, ==, HB_SET_VALUE_INVALID);
g_assert (hb_set_is_empty (s));
} | false | false | false | false | false | 0 |
d_laplace( FMField *out, FMField *gradP1, FMField *gradP2,
FMField *coef, VolumeGeometry *vg,
int32 *elList, int32 elList_nRow )
{
int32 ii, iel, dim, nQP, ret = RET_OK;
FMField *dgp2 = 0, *gp1tdgp2 = 0;
nQP = vg->bfGM->nLev;
dim = vg->bfGM->nRow;
fmf_createAlloc( &dgp2, 1, nQP, dim, 1 );
fmf_createAlloc( &gp1tdgp2, 1, nQP, 1, 1 );
for (ii = 0; ii < elList_nRow; ii++) {
iel = elList[ii];
FMF_SetCell( out, ii );
FMF_SetCell( vg->det, iel );
FMF_SetCell( gradP1, iel );
FMF_SetCell( gradP2, iel );
if (coef->nCell > 1) {
FMF_SetCell( coef, ii );
}
fmf_mulAF( dgp2, gradP2, coef->val );
fmf_mulATB_nn( gp1tdgp2, gradP1, dgp2 );
fmf_sumLevelsMulF( out, gp1tdgp2, vg->det->val );
ERR_CheckGo( ret );
}
end_label:
fmf_freeDestroy( &dgp2 );
fmf_freeDestroy( &gp1tdgp2 );
return( ret );
} | false | false | false | false | false | 0 |
imap_vprintf( const char *fmt, va_list ap )
{
const char *s, *es;
char *d, *ed;
int maxlen;
char c;
char buf[1024]; /* Minimal supported command buffer size per IMAP spec. */
d = buf;
ed = d + sizeof(buf);
s = fmt;
for (;;) {
c = *fmt;
if (!c || c == '%') {
int l = fmt - s;
if (d + l > ed)
oob();
memcpy( d, s, l );
d += l;
if (!c) {
l = d - buf;
ed = nfmalloc( l + 1 );
memcpy( ed, buf, l );
ed[l] = 0;
return ed;
}
maxlen = INT_MAX;
c = *++fmt;
if (c == '\\') {
c = *++fmt;
if (c != 's') {
fputs( "Fatal: unsupported escaped format specifier. Please report a bug.\n", stderr );
abort();
}
s = va_arg( ap, const char * );
while ((c = *s++)) {
if (d + 2 > ed)
oob();
if (c == '\\' || c == '"')
*d++ = '\\';
*d++ = c;
}
} else { /* \\ cannot be combined with anything else. */
if (c == '.') {
c = *++fmt;
if (c != '*') {
fputs( "Fatal: unsupported string length specification. Please report a bug.\n", stderr );
abort();
}
maxlen = va_arg( ap , int );
c = *++fmt;
}
if (c == 'c') {
if (d + 1 > ed)
oob();
*d++ = (char)va_arg( ap , int );
} else if (c == 's') {
s = va_arg( ap, const char * );
es = memchr( s, 0, maxlen );
l = es ? es - s : maxlen;
if (d + l > ed)
oob();
memcpy( d, s, l );
d += l;
} else if (c == 'd') {
d += nfsnprintf( d, ed - d, "%d", va_arg( ap , int ) );
} else {
fputs( "Fatal: unsupported format specifier. Please report a bug.\n", stderr );
abort();
}
}
s = ++fmt;
} else {
fmt++;
}
}
} | false | false | false | false | false | 0 |
ev_signal_stop (EV_P_ ev_signal *w) EV_THROW
{
clear_pending (EV_A_ (W)w);
if (expect_false (!ev_is_active (w)))
return;
EV_FREQUENT_CHECK;
wlist_del (&signals [w->signum - 1].head, (WL)w);
ev_stop (EV_A_ (W)w);
if (!signals [w->signum - 1].head)
{
#if EV_MULTIPLICITY
signals [w->signum - 1].loop = 0; /* unattach from signal */
#endif
#if EV_USE_SIGNALFD
if (sigfd >= 0)
{
sigset_t ss;
sigemptyset (&ss);
sigaddset (&ss, w->signum);
sigdelset (&sigfd_set, w->signum);
signalfd (sigfd, &sigfd_set, 0);
sigprocmask (SIG_UNBLOCK, &ss, 0);
}
else
#endif
signal (w->signum, SIG_DFL);
}
EV_FREQUENT_CHECK;
} | false | false | false | false | false | 0 |
mpickstuff(struct monst *mtmp, const char *str)
{
struct obj *otmp, *otmp2;
/* prevent shopkeepers from leaving the door of their shop */
if(mtmp->isshk && inhishop(mtmp)) return false;
for(otmp = level.objects[mtmp->mx][mtmp->my]; otmp; otmp = otmp2)
{
otmp2 = otmp->nexthere;
/* Nymphs take everything. Most monsters don't pick up corpses. */
if (!str ? searches_for_item(mtmp,otmp) :
!!(index(str, otmp->oclass)))
{
if (otmp->otyp == CORPSE && mtmp->data->mlet != S_NYMPH &&
/* let a handful of corpse types thru to can_carry() */
!touch_petrifies(&mons[otmp->corpsenm]) &&
otmp->corpsenm != PM_LIZARD &&
!acidic(&mons[otmp->corpsenm]))
{
continue;
}
if (!touch_artifact(otmp,mtmp))
{
continue;
}
if (!can_carry(mtmp,otmp))
{
continue;
}
if (is_pool(mtmp->mx,mtmp->my))
{
continue;
}
if (cansee(mtmp->mx,mtmp->my) && flags.verbose)
pline("%s picks up %s.", Monnam(mtmp),
(distu(mtmp->mx, mtmp->my) <= 5) ?
doname(otmp) : distant_name(otmp, doname));
obj_extract_self(otmp);
/* unblock point after extract, before pickup */
if (otmp->otyp == BOULDER)
unblock_point(otmp->ox,otmp->oy); /* vision */
mpickobj(mtmp, otmp); /* may merge and free otmp */
m_dowear(mtmp, false);
newsym(mtmp->mx, mtmp->my);
return true; /* pick only one object */
}
}
return false;
} | false | false | false | false | false | 0 |
l2tp_send_OCCN(struct l2tp_sess_t *sess)
{
struct l2tp_packet_t *pack = NULL;
log_session(log_info2, sess, "sending OCCN\n");
pack = l2tp_packet_alloc(2, Message_Type_Outgoing_Call_Connected,
&sess->paren_conn->peer_addr, sess->hide_avps,
sess->paren_conn->secret,
sess->paren_conn->secret_len);
if (pack == NULL) {
log_session(log_error, sess, "impossible to send OCCN:"
" packet allocation failed\n");
return -1;
}
if (l2tp_packet_add_int32(pack, TX_Speed, 1000, 1) < 0) {
log_session(log_error, sess, "impossible to send OCCN:"
" adding data to packet failed\n");
goto out_err;
}
if (l2tp_packet_add_int32(pack, Framing_Type, 3, 1) < 0) {
log_session(log_error, sess, "impossible to send OCCN:"
" adding data to packet failed\n");
goto out_err;
}
if (sess->send_seq &&
l2tp_packet_add_octets(pack, Sequencing_Required, NULL, 0, 1) < 0) {
log_session(log_error, sess, "impossible to send OCCN:"
" adding data to packet failed\n");
goto out_err;
}
l2tp_session_send(sess, pack);
return 0;
out_err:
l2tp_packet_free(pack);
return -1;
} | false | false | false | false | false | 0 |
queueMultiCommand(redisClient *c, struct redisCommand *cmd) {
multiCmd *mc;
int j;
c->mstate.commands = zrealloc(c->mstate.commands,
sizeof(multiCmd)*(c->mstate.count+1));
mc = c->mstate.commands+c->mstate.count;
mc->cmd = cmd;
mc->argc = c->argc;
mc->argv = zmalloc(sizeof(robj*)*c->argc);
memcpy(mc->argv,c->argv,sizeof(robj*)*c->argc);
for (j = 0; j < c->argc; j++)
incrRefCount(mc->argv[j]);
c->mstate.count++;
} | false | false | false | false | false | 0 |
iio_map_array_unregister(struct iio_dev *indio_dev)
{
int ret = -ENODEV;
struct iio_map_internal *mapi;
struct list_head *pos, *tmp;
mutex_lock(&iio_map_list_lock);
list_for_each_safe(pos, tmp, &iio_map_list) {
mapi = list_entry(pos, struct iio_map_internal, l);
if (indio_dev == mapi->indio_dev) {
list_del(&mapi->l);
kfree(mapi);
ret = 0;
}
}
mutex_unlock(&iio_map_list_lock);
return ret;
} | false | false | false | false | false | 0 |
expandDim(const QSize& orig, WidgetType wt, int baseMarginMetric,
const QStyleOption* opt, const QWidget* w, bool rotated) const
{
int addWidth = 2*widgetLayoutProp(wt, baseMarginMetric + MainMargin, opt, w) +
widgetLayoutProp(wt, baseMarginMetric + Left, opt, w) +
widgetLayoutProp(wt, baseMarginMetric + Right, opt, w);
int addHeight = 2*widgetLayoutProp(wt, baseMarginMetric + MainMargin, opt, w) +
widgetLayoutProp(wt, baseMarginMetric + Top, opt, w) +
widgetLayoutProp(wt, baseMarginMetric + Bot, opt, w);
return QSize(orig.width() + (rotated? addHeight: addWidth),
orig.height() + (rotated? addWidth: addHeight));
} | false | false | false | false | false | 0 |
parseInt(char* &p, int& i) {
while (*p==' ' || *p=='\t') p++;
char* start=p;
if (*p=='-') p++;
else if (*p=='+') { p++;start++; }
while ((*p>='1' && *p<='9') || *p=='0') p++;
//now p is on a non-digit;
if (*start=='-' && p==start+1) return false;
char saved=*p;
*p='\0';
char* endptr=p;
long l=strtol(start,&endptr,10);
i=(int)l;
*p=saved;
if (endptr!=p || i!=l) return false;
return true;
} | false | false | false | false | false | 0 |
rerere_io_putmem(const char *mem, size_t sz, struct rerere_io *io)
{
if (io->output)
ferr_write(mem, sz, io->output, &io->wrerror);
} | false | false | false | false | false | 0 |
dwConfigure(dwDevice_t* dev)
{
dwEnableClock(dev, dwClockAuto);
delayms(5);
// Reset the chip
if (dev->ops->reset) {
dev->ops->reset(dev);
} else {
dwSoftReset(dev);
}
if (dwGetDeviceId(dev) != 0xdeca0130) {
return DW_ERROR_WRONG_ID;
}
// Set default address
memset(dev->networkAndAddress, 0xff, LEN_PANADR);
dwSpiWrite(dev, PANADR, NO_SUB, dev->networkAndAddress, LEN_PANADR);
// default configuration
memset(dev->syscfg, 0, LEN_SYS_CFG);
dwSetDoubleBuffering(dev, false);
dwSetInterruptPolarity(dev, true);
dwWriteSystemConfigurationRegister(dev);
// default interrupt mask, i.e. no interrupts
dwClearInterrupts(dev);
dwWriteSystemEventMaskRegister(dev);
// load LDE micro-code
dwEnableClock(dev, dwClockXti);
delayms(5);
dwManageLDE(dev);
delayms(5);
dwEnableClock(dev, dwClockPll);
delayms(5);
//dev->ops->spiSetSpeed(dev, dwSpiSpeedHigh);
// //Enable LED clock
// dwSpiWrite32(dev, PMSC, PMSC_CTRL0_SUB, dwSpiRead32(dev, PMSC, PMSC_CTRL0_SUB) | 0x008C0000);
//
// // Setup all LEDs
//
// dwSpiWrite32(dev, 0x26, 0x00, dwSpiRead32(dev, 0x26, 0x00) | 0x1540);
//
// // Start the pll
//
// delayms(1);
// Initialize for default configuration (as per datasheet)
return DW_ERROR_OK;
} | false | false | false | false | false | 0 |
gst_object_get_name (GstObject * object)
{
gchar *result = NULL;
g_return_val_if_fail (GST_IS_OBJECT (object), NULL);
GST_OBJECT_LOCK (object);
result = g_strdup (object->name);
GST_OBJECT_UNLOCK (object);
return result;
} | false | false | false | false | false | 0 |
processingStarted()
{
ProgressDialog->setLabelText( tr( "Please wait while gpsbabel is processing data..." ) );
ProgressDialog->setMinimum( 0 );
ProgressDialog->setMaximum( 0 );
ProgressDialog->exec();
ProgressDialog->setValue( 0 );
} | false | false | false | false | false | 0 |
es_freeSurface(sdl_data *sd, int len, char * buff)
{
char *bp;
SDL_Surface * sptr;
bp = buff;
POPGLPTR(sptr, bp);
if(sptr == NULL)
error();
SDL_FreeSurface(sptr);
} | false | false | false | false | false | 0 |
convergeephemerons (global_State *g) {
int changed;
do {
GCObject *w;
GCObject *next = g->ephemeron; /* get ephemeron list */
g->ephemeron = NULL; /* tables may return to this list when traversed */
changed = 0;
while ((w = next) != NULL) {
next = gco2t(w)->gclist;
if (traverseephemeron(g, gco2t(w))) { /* traverse marked some value? */
propagateall(g); /* propagate changes */
changed = 1; /* will have to revisit all ephemeron tables */
}
}
} while (changed);
} | false | false | false | false | false | 0 |
find_uses_to_rename_stmt (gimple stmt, bitmap *use_blocks, bitmap need_phis)
{
ssa_op_iter iter;
tree var;
basic_block bb = gimple_bb (stmt);
if (is_gimple_debug (stmt))
return;
FOR_EACH_SSA_TREE_OPERAND (var, stmt, iter, SSA_OP_ALL_USES)
find_uses_to_rename_use (bb, var, use_blocks, need_phis);
} | false | false | false | false | false | 0 |
unputcmdline()
{
if (cmd_silent)
return;
msg_no_more = TRUE;
if (ccline.cmdlen == ccline.cmdpos)
msg_putchar(' ');
#ifdef FEAT_MBYTE
else if (has_mbyte)
draw_cmdline(ccline.cmdpos,
(*mb_ptr2len)(ccline.cmdbuff + ccline.cmdpos));
#endif
else
draw_cmdline(ccline.cmdpos, 1);
msg_no_more = FALSE;
cursorcmd();
} | false | false | false | false | false | 0 |
reset_pattern(void)
{
int i, j;
maxi = 0;
maxj = 0;
ci = -1;
cj = -1;
where = 0;
el = 0;
num_stars = 0;
strcpy(helper_fn_names[patno], "NULL");
for (i = 0; i < 256; i++)
label_coords[i][0] = -1;
current_c_i = 0;
constraint[0] = 0;
action[0] = 0;
for (i = 0; i < MAX_BOARD+2; i++) {
for (j = 0; j < MAX_BOARD+3; j++) {
diagram[i][j] = '\0';
constraint_diagram[i][j] = '\0';
}
}
memset(&pattern[patno], 0, sizeof(struct pattern));
} | false | false | false | false | false | 0 |
xstrcmp (char *s1, char *s2, size_t len)
{
/* Repeat until we run into null byte or white space in either string. */
while (len--)
{
if (tolower (*s1) != tolower (*s2))
return false;
s1++;
s2++;
}
return true;
} | false | false | false | false | false | 0 |
unpack_broken_parameters(ParseContext *context, Octstr *decoded)
{
int ret = 0;
int first = 1;
long pos;
while (ret >= 0 && !parse_error(context) &&
parse_octets_left(context) > 0) {
pos = octstr_len(decoded);
ret = unpack_parameter(context, decoded);
if (ret >= 0) {
if (first) {
/* Zap ';' */
octstr_delete(decoded, pos, 1);
first = 0;
} else {
/* Replace ';' with ',' */
octstr_set_char(decoded, pos, first ? ' ' : ',');
}
}
}
} | false | false | false | false | false | 0 |
highestUndoLevel(Solver& s) const {
return up_ != undoStart()
? s.level(lits_->var(undoTop().idx()))
: 0;
} | false | false | false | false | false | 0 |
spif_dlinked_list_item_init(spif_dlinked_list_item_t self)
{
ASSERT_RVAL(!SPIF_DLINKED_LIST_ITEM_ISNULL(self), FALSE);
self->data = SPIF_NULL_TYPE(obj);
self->prev = SPIF_NULL_TYPE(dlinked_list_item);
self->next = SPIF_NULL_TYPE(dlinked_list_item);
return TRUE;
} | false | false | false | false | false | 0 |
unix_wait(value unit)
{
int pid, status;
enter_blocking_section();
pid = wait(&status);
leave_blocking_section();
if (pid == -1) uerror("wait", Nothing);
return alloc_process_status(pid, status);
} | false | false | false | false | true | 1 |
fbtft_register_backlight(struct fbtft_par *par)
{
struct backlight_device *bd;
struct backlight_properties bl_props = { 0, };
if (par->gpio.led[0] == -1) {
fbtft_par_dbg(DEBUG_BACKLIGHT, par,
"%s(): led pin not set, exiting.\n", __func__);
return;
}
bl_props.type = BACKLIGHT_RAW;
/* Assume backlight is off, get polarity from current state of pin */
bl_props.power = FB_BLANK_POWERDOWN;
if (!gpio_get_value(par->gpio.led[0]))
bl_props.state |= BL_CORE_DRIVER1;
bd = backlight_device_register(dev_driver_string(par->info->device),
par->info->device, par, &fbtft_bl_ops, &bl_props);
if (IS_ERR(bd)) {
dev_err(par->info->device,
"cannot register backlight device (%ld)\n",
PTR_ERR(bd));
return;
}
par->info->bl_dev = bd;
if (!par->fbtftops.unregister_backlight)
par->fbtftops.unregister_backlight = fbtft_unregister_backlight;
} | false | false | false | false | false | 0 |
common_find_ctrl_id(const char *name)
{
if (ctrl_str2q.find(name) == ctrl_str2q.end())
return 0;
return ctrl_str2q[name].id;
} | false | false | false | false | false | 0 |
asle_set_backlight(struct drm_device *dev, u32 bclp)
{
struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_connector *intel_connector;
struct opregion_asle *asle = dev_priv->opregion.asle;
DRM_DEBUG_DRIVER("bclp = 0x%08x\n", bclp);
if (acpi_video_get_backlight_type() == acpi_backlight_native) {
DRM_DEBUG_KMS("opregion backlight request ignored\n");
return 0;
}
if (!(bclp & ASLE_BCLP_VALID))
return ASLC_BACKLIGHT_FAILED;
bclp &= ASLE_BCLP_MSK;
if (bclp > 255)
return ASLC_BACKLIGHT_FAILED;
drm_modeset_lock(&dev->mode_config.connection_mutex, NULL);
/*
* Update backlight on all connectors that support backlight (usually
* only one).
*/
DRM_DEBUG_KMS("updating opregion backlight %d/255\n", bclp);
list_for_each_entry(intel_connector, &dev->mode_config.connector_list, base.head)
intel_panel_set_backlight_acpi(intel_connector, bclp, 255);
asle->cblv = DIV_ROUND_UP(bclp * 100, 255) | ASLE_CBLV_VALID;
drm_modeset_unlock(&dev->mode_config.connection_mutex);
return 0;
} | false | false | false | false | false | 0 |
shell_exec_memory_show_options(struct gnutella_shell *sh,
int argc, const char *argv[])
{
show_vec_t v[3];
shell_check(sh);
g_assert(argv);
g_assert(argc > 0);
v[0].cb = xmalloc_show_settings_log;
v[0].prefix = NULL;
v[1].cb = malloc_show_settings_log;
v[1].prefix = "malloc ";
v[2].cb = shell_vtable_settings_log;
v[2].prefix = NULL;
return memory_run_showerv(sh, v, G_N_ELEMENTS(v));
} | false | false | false | false | false | 0 |
worker(void *arg)
{
struct worker *ego = (struct worker *)arg;
struct work *w;
for (;;) {
/* wait until work becomes available */
os_sem_down(&ego->ready);
w = ego->w;
/* !w->proc ==> terminate worker */
if (!w->proc) break;
/* do the work */
w->proc(&w->d);
/* signal that work is done */
os_sem_up(&ego->done);
}
/* termination protocol */
os_sem_up(&termination_semaphore);
os_destroy_thread();
/* UNREACHABLE */
return 0;
} | false | false | false | false | false | 0 |
hdrl_image_get_sqsum(const hdrl_image * self, double * result, double * error)
{
/* TODO should be collapse object */
cpl_ensure_code(result, CPL_ERROR_NULL_INPUT);
*result = cpl_image_get_sqflux(self->image);
if (error) {
return cpl_error_set_message(cpl_func, CPL_ERROR_UNSUPPORTED_MODE,
"Error of square sum not supported yet");
}
return cpl_error_get_code();
} | false | false | false | false | false | 0 |
applianceCommand(int command)
{
qWarning("AbstractAppliance::applianceCommand: current appliance '%s' doesn't handle command %d", qPrintable(applianceName()), command);
return false;
} | false | false | false | false | false | 0 |
speakup_add_virtual_keyboard(void)
{
int err;
virt_keyboard = input_allocate_device();
if (!virt_keyboard)
return -ENOMEM;
virt_keyboard->name = "Speakup";
virt_keyboard->id.bustype = BUS_VIRTUAL;
virt_keyboard->phys = "speakup/input0";
virt_keyboard->dev.parent = NULL;
__set_bit(EV_KEY, virt_keyboard->evbit);
__set_bit(KEY_DOWN, virt_keyboard->keybit);
err = input_register_device(virt_keyboard);
if (err) {
input_free_device(virt_keyboard);
virt_keyboard = NULL;
}
return err;
} | false | false | false | false | false | 0 |
_parse_appinfo(BITSTREAM *bits, MPLS_AI *ai)
{
int len;
off_t pos;
if (!bs_is_align(bits, 0x07)) {
fprintf(stderr, "_parse_appinfo: alignment error\n");
}
pos = bs_pos(bits) >> 3;
len = bs_read(bits, 32);
// Reserved
bs_skip(bits, 8);
ai->playback_type = bs_read(bits, 8);
if (ai->playback_type == 2 || ai->playback_type == 3) {
ai->playback_count = bs_read(bits, 16);
} else {
// Reserved
bs_skip(bits, 16);
}
_parse_uo(bits, &ai->uo_mask);
ai->random_access_flag = bs_read(bits, 1);
ai->audio_mix_flag = bs_read(bits, 1);
ai->lossless_bypass_flag = bs_read(bits, 1);
// Reserved
bs_skip(bits, 13);
bs_seek_byte(bits, pos + len);
return 1;
} | false | false | false | false | false | 0 |
find_referenced_vars_in (gimple stmt)
{
size_t i;
if (gimple_code (stmt) != GIMPLE_PHI)
{
for (i = 0; i < gimple_num_ops (stmt); i++)
walk_tree (gimple_op_ptr (stmt, i), find_vars_r, NULL, NULL);
}
else
{
walk_tree (gimple_phi_result_ptr (stmt), find_vars_r, NULL, NULL);
for (i = 0; i < gimple_phi_num_args (stmt); i++)
{
tree arg = gimple_phi_arg_def (stmt, i);
walk_tree (&arg, find_vars_r, NULL, NULL);
}
}
} | false | false | false | false | false | 0 |
set_nports(int new_ninputs, int new_noutputs)
{
// exit on bad counts, or if already initialized
if (new_ninputs < 0 || new_noutputs < 0)
return -EINVAL;
if (_router && _router->_have_connections) {
if (_router->_state >= Router::ROUTER_PREINITIALIZE)
return -EBUSY;
_router->_have_connections = false;
}
// decide if inputs & outputs were inlined
bool old_in_inline =
(_ports[0] == _inline_ports);
bool old_out_inline =
(_ports[1] == _inline_ports || _ports[1] == _inline_ports + _nports[0]);
// decide if inputs & outputs should be inlined
bool new_in_inline =
(new_ninputs == 0
|| new_ninputs + new_noutputs <= INLINE_PORTS
|| (new_ninputs <= INLINE_PORTS && new_noutputs > INLINE_PORTS)
|| (new_ninputs <= INLINE_PORTS && new_ninputs > new_noutputs
&& processing() == PULL));
bool new_out_inline =
(new_noutputs == 0
|| new_ninputs + new_noutputs <= INLINE_PORTS
|| (new_noutputs <= INLINE_PORTS && !new_in_inline));
// create new port arrays
Port *new_inputs =
(new_in_inline ? _inline_ports : new Port[new_ninputs]);
if (!new_inputs) // out of memory -- return
return -ENOMEM;
Port *new_outputs =
(new_out_inline ? _inline_ports + (new_in_inline ? new_ninputs : 0)
: new Port[new_noutputs]);
if (!new_outputs) { // out of memory -- return
if (!new_in_inline)
delete[] new_inputs;
return -ENOMEM;
}
// install information
if (!old_in_inline)
delete[] _ports[0];
if (!old_out_inline)
delete[] _ports[1];
_ports[0] = new_inputs;
_ports[1] = new_outputs;
_nports[0] = new_ninputs;
_nports[1] = new_noutputs;
return 0;
} | false | false | false | false | false | 0 |
handle_edit_startpos(struct connection *pconn,
const struct packet_edit_startpos *packet)
{
struct tile *ptile = index_to_tile(packet->id);
bool changed;
/* Check. */
if (NULL == ptile) {
notify_conn(pconn->self, NULL, E_BAD_COMMAND, ftc_editor,
_("Invalid tile index %d for start position."), packet->id);
return;
}
/* Handle. */
if (packet->remove) {
changed = map_startpos_remove(ptile);
} else {
if (NULL != map_startpos_get(ptile)) {
changed = FALSE;
} else {
map_startpos_new(ptile);
changed = TRUE;
}
}
/* Notify. */
if (changed) {
conn_list_iterate(game.est_connections, aconn) {
if (can_conn_edit(aconn)) {
send_packet_edit_startpos(aconn, packet);
}
} conn_list_iterate_end;
}
} | false | false | false | false | false | 0 |
service_string_to_list(char *services)
{
GSList *l = NULL;
char *start = services;
int i, finished = 0;
for (i = 0; !finished; i++) {
if (services[i] == '\0')
finished = 1;
if (services[i] == ' ' || services[i] == '\0') {
services[i] = '\0';
l = g_slist_append(l, start);
start = services + i + 1;
}
}
return l;
} | false | false | false | false | false | 0 |
Eigenvalues(TVector Re, TVector Im, TMatrix X)
{
int n;
if (!Re || !Im || !X)
{
dw_Error(NULL_ERR);
return 0;
}
if (Re == Im)
{
dw_Error(ARG_ERR);
return 0;
}
n=RowM(X);
if ((ColM(X) != n) || (DimV(Re) != n) || (DimV(Im) != n))
{
dw_Error(SIZE_ERR);
return 0;
}
return bEigenvalues(pElementV(Re),pElementV(Im),pElementM(X),n,MajorForm(X)) ? 0 : 1;
} | false | false | false | false | false | 0 |
main (int argc, char **argv)
{
GError *error = NULL;
char *base;
const char *clients[2][2] = { {DHCLIENT_PATH, "dhclient"}, {DHCPCD_PATH, "dhcpcd"} };
guint32 i;
g_type_init ();
if (!nm_utils_init (&error))
FAIL ("nm-utils-init", "failed to initialize libnm-util: %s", error->message);
/* The tests */
for (i = 0; i < 2; i++) {
const char *client_path = clients[i][0];
const char *client = clients[i][1];
if (!client_path || !strlen (client_path))
continue;
test_generic_options (client);
test_wins_options (client);
test_classless_static_routes_1 (client);
test_classless_static_routes_2 (client);
test_fedora_dhclient_classless_static_routes (client);
test_dhclient_invalid_classless_routes_1 (client);
test_dhcpcd_invalid_classless_routes_1 (client);
test_dhclient_invalid_classless_routes_2 (client);
test_dhcpcd_invalid_classless_routes_2 (client);
test_dhclient_invalid_classless_routes_3 (client);
test_dhcpcd_invalid_classless_routes_3 (client);
test_dhclient_gw_in_classless_routes (client);
test_dhcpcd_gw_in_classless_routes (client);
test_escaped_domain_searches (client);
test_invalid_escaped_domain_searches (client);
test_ip4_missing_prefix (client, "192.168.1.10", 24);
test_ip4_missing_prefix (client, "172.16.54.50", 16);
test_ip4_missing_prefix (client, "10.1.2.3", 8);
test_ip4_prefix_classless (client);
}
base = g_path_get_basename (argv[0]);
fprintf (stdout, "%s: SUCCESS\n", base);
g_free (base);
return 0;
} | true | true | false | false | false | 1 |
_bfd_elf_strtab_delref (struct elf_strtab_hash *tab, bfd_size_type idx)
{
if (idx == 0 || idx == (bfd_size_type) -1)
return;
BFD_ASSERT (tab->sec_size == 0);
BFD_ASSERT (idx < tab->size);
BFD_ASSERT (tab->array[idx]->refcount > 0);
--tab->array[idx]->refcount;
} | false | false | false | false | false | 0 |
WalSndShmemInit(void)
{
bool found;
int i;
WalSndCtl = (WalSndCtlData *)
ShmemInitStruct("Wal Sender Ctl", WalSndShmemSize(), &found);
if (!found)
{
/* First time through, so initialize */
MemSet(WalSndCtl, 0, WalSndShmemSize());
for (i = 0; i < max_wal_senders; i++)
{
WalSnd *walsnd = &WalSndCtl->walsnds[i];
SpinLockInit(&walsnd->mutex);
InitSharedLatch(&walsnd->latch);
}
}
} | false | false | false | false | false | 0 |
getARClassRegisterMask(StringRef Reg, StringRef Flags) {
// The mask operand contains the special register (R Bit) in bit 4, whether
// the register is spsr (R bit is 1) or one of cpsr/apsr (R bit is 0), and
// bits 3-0 contains the fields to be accessed in the special register, set by
// the flags provided with the register.
int Mask = 0;
if (Reg == "apsr") {
// The flags permitted for apsr are the same flags that are allowed in
// M class registers. We get the flag value and then shift the flags into
// the correct place to combine with the mask.
Mask = getMClassFlagsMask(Flags, true);
if (Mask == -1)
return -1;
return Mask << 2;
}
if (Reg != "cpsr" && Reg != "spsr") {
return -1;
}
// This is the same as if the flags were "fc"
if (Flags.empty() || Flags == "all")
return Mask | 0x9;
// Inspect the supplied flags string and set the bits in the mask for
// the relevant and valid flags allowed for cpsr and spsr.
for (char Flag : Flags) {
int FlagVal;
switch (Flag) {
case 'c':
FlagVal = 0x1;
break;
case 'x':
FlagVal = 0x2;
break;
case 's':
FlagVal = 0x4;
break;
case 'f':
FlagVal = 0x8;
break;
default:
FlagVal = 0;
}
// This avoids allowing strings where the same flag bit appears twice.
if (!FlagVal || (Mask & FlagVal))
return -1;
Mask |= FlagVal;
}
// If the register is spsr then we need to set the R bit.
if (Reg == "spsr")
Mask |= 0x10;
return Mask;
} | false | false | false | false | false | 0 |
DownloadPitFile(unsigned char **pitBuffer) const
{
Interface::Print("Downloading device's PIT file...\n");
int devicePitFileSize = ReceivePitFile(pitBuffer);
if (!*pitBuffer)
{
Interface::PrintError("Failed to download PIT file!\n");
return (0);
}
Interface::Print("PIT file download successful.\n\n");
return (devicePitFileSize);
} | false | false | false | false | false | 0 |
tag2_status_changed(MpdObj * mi, ChangedStatusType what, gpointer data)
{
if (what & MPD_CST_DATABASE)
{
if (tag2_ht)
{
g_list_foreach(tag2_ht, (GFunc) tag2_connection_changed_foreach, NULL);
/* GList *list = g_list_first(tag2_ht);
for(;list;list = g_list_next(list))
{
tag2_songlist_clear_selection(NULL, list->data);
}
*/
}
}
} | false | false | false | false | false | 0 |
vmw_dmabuf_alloc_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv)
{
struct vmw_private *dev_priv = vmw_priv(dev);
union drm_vmw_alloc_dmabuf_arg *arg =
(union drm_vmw_alloc_dmabuf_arg *)data;
struct drm_vmw_alloc_dmabuf_req *req = &arg->req;
struct drm_vmw_dmabuf_rep *rep = &arg->rep;
struct vmw_dma_buffer *dma_buf;
uint32_t handle;
int ret;
ret = ttm_read_lock(&dev_priv->reservation_sem, true);
if (unlikely(ret != 0))
return ret;
ret = vmw_user_dmabuf_alloc(dev_priv, vmw_fpriv(file_priv)->tfile,
req->size, false, &handle, &dma_buf,
NULL);
if (unlikely(ret != 0))
goto out_no_dmabuf;
rep->handle = handle;
rep->map_handle = drm_vma_node_offset_addr(&dma_buf->base.vma_node);
rep->cur_gmr_id = handle;
rep->cur_gmr_offset = 0;
vmw_dmabuf_unreference(&dma_buf);
out_no_dmabuf:
ttm_read_unlock(&dev_priv->reservation_sem);
return ret;
} | false | false | false | false | false | 0 |
_slurm_rpc_dump_jobs(slurm_msg_t * msg)
{
DEF_TIMERS;
char *dump;
int dump_size;
slurm_msg_t response_msg;
job_info_request_msg_t *job_info_request_msg =
(job_info_request_msg_t *) msg->data;
/* Locks: Read config job, write node (for hiding) */
slurmctld_lock_t job_read_lock = {
READ_LOCK, READ_LOCK, NO_LOCK, WRITE_LOCK };
uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, NULL);
START_TIMER;
debug3("Processing RPC: REQUEST_JOB_INFO from uid=%d", uid);
lock_slurmctld(job_read_lock);
if ((job_info_request_msg->last_update - 1) >= last_job_update) {
unlock_slurmctld(job_read_lock);
debug3("_slurm_rpc_dump_jobs, no change");
slurm_send_rc_msg(msg, SLURM_NO_CHANGE_IN_DATA);
} else {
pack_all_jobs(&dump, &dump_size,
job_info_request_msg->show_flags,
g_slurm_auth_get_uid(msg->auth_cred, NULL),
msg->protocol_version);
unlock_slurmctld(job_read_lock);
END_TIMER2("_slurm_rpc_dump_jobs");
/* info("_slurm_rpc_dump_jobs, size=%d %s", */
/* dump_size, TIME_STR); */
/* init response_msg structure */
slurm_msg_t_init(&response_msg);
response_msg.flags = msg->flags;
response_msg.protocol_version = msg->protocol_version;
response_msg.address = msg->address;
response_msg.msg_type = RESPONSE_JOB_INFO;
response_msg.data = dump;
response_msg.data_size = dump_size;
/* send message */
slurm_send_node_msg(msg->conn_fd, &response_msg);
xfree(dump);
}
} | false | false | false | false | false | 0 |
bdev_readpage(void *_sb, struct page *page)
{
struct super_block *sb = _sb;
struct block_device *bdev = logfs_super(sb)->s_bdev;
int err;
err = sync_request(page, bdev, READ);
if (err) {
ClearPageUptodate(page);
SetPageError(page);
} else {
SetPageUptodate(page);
ClearPageError(page);
}
unlock_page(page);
return err;
} | false | false | false | false | false | 0 |
test_strfunc(const char *str, char **ret)
{
char *s = strdup(str);
int x = 0;
if (s == NULL)
return nerr_raise(NERR_NOMEM, "Unable to duplicate string in test_strfunc");
while (s[x]) {
s[x] = tolower(s[x]);
x++;
}
*ret = s;
return STATUS_OK;
} | false | false | false | false | false | 0 |
main (int argc, char **argv)
{
CphIfaceMechanism *proxy;
gboolean ret;
GError *error;
g_type_init ();
error = NULL;
proxy = cph_iface_mechanism_proxy_new_for_bus_sync (
G_BUS_TYPE_SYSTEM,
G_DBUS_PROXY_FLAGS_NONE,
"org.opensuse.CupsPkHelper.Mechanism",
"/",
NULL,
&error);
if (proxy == NULL) {
g_warning ("Could not get proxy: %s",
error->message);
g_error_free (error);
return 1;
}
error = NULL;
ret = printer_add (G_DBUS_PROXY (proxy),
"MyPrinter", "smb://really/cool",
"HP/Business_Inkjet_2200-chp2200.ppd.gz",
"This is my printer", "At home",
&error);
if (!ret) {
if (error) {
g_print ("Error: %s\n", error->message);
g_error_free (error);
} else
g_print ("Unknown error\n");
}
g_object_unref (proxy);
return 0;
} | false | false | false | false | false | 0 |
ibus_bus_preload_engines_async (IBusBus *bus,
const gchar * const *names,
gint timeout_msec,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
GVariant *variant = NULL;
g_return_if_fail (IBUS_IS_BUS (bus));
g_return_if_fail (names != NULL && names[0] != NULL);
variant = g_variant_new_strv(names, -1);
ibus_bus_call_async (bus,
IBUS_SERVICE_IBUS,
IBUS_PATH_IBUS,
"org.freedesktop.DBus.Properties",
"Set",
g_variant_new ("(ssv)",
IBUS_INTERFACE_IBUS,
"PreloadEngines",
variant),
NULL, /* no return value */
ibus_bus_preload_engines_async,
timeout_msec,
cancellable,
callback,
user_data);
} | false | false | false | false | false | 0 |
add_new_pl_or_spl_user_name(iTunesDB *itdb, gchar *dflt, gint32 position) {
ExtraiTunesDBData *eitdb;
gboolean is_spl = FALSE;
gchar *name;
g_return_if_fail (itdb);
eitdb = itdb->userdata;
g_return_if_fail (eitdb);
if (!eitdb->itdb_imported) {
gtkpod_warning_simple(_("Please load the iPod before adding playlists."));
return;
}
name = dflt ? dflt : _("New Playlist");
retry:
name
= get_user_string(_("New Playlist"), _("Please enter a name for the new playlist"), name, _("Smart Playlist"), &is_spl, GTK_STOCK_ADD);
if (!name)
return;
if (strlen(name) == 0) {
gtkpod_warning_simple(_("Playlist name cannot be blank"));
goto retry;
}
Playlist *pl = itdb_playlist_by_name(itdb, name);
if (pl) {
gtkpod_warning_simple(_("A playlist named '%s' already exists"), name);
goto retry;
}
if (!is_spl) { /* add standard playlist */
gp_playlist_add_new(itdb, name, FALSE, position);
gtkpod_tracks_statusbar_update ();
}
else { /* add smart playlist */
spl_edit_new(itdb, name, position);
}
} | false | false | false | false | false | 0 |
cfg_layout_delete_block (basic_block bb)
{
rtx insn, next, prev = PREV_INSN (BB_HEAD (bb)), *to, remaints;
if (bb->rbi->header)
{
next = BB_HEAD (bb);
if (prev)
NEXT_INSN (prev) = bb->rbi->header;
else
set_first_insn (bb->rbi->header);
PREV_INSN (bb->rbi->header) = prev;
insn = bb->rbi->header;
while (NEXT_INSN (insn))
insn = NEXT_INSN (insn);
NEXT_INSN (insn) = next;
PREV_INSN (next) = insn;
}
next = NEXT_INSN (BB_END (bb));
if (bb->rbi->footer)
{
insn = bb->rbi->footer;
while (insn)
{
if (GET_CODE (insn) == BARRIER)
{
if (PREV_INSN (insn))
NEXT_INSN (PREV_INSN (insn)) = NEXT_INSN (insn);
else
bb->rbi->footer = NEXT_INSN (insn);
if (NEXT_INSN (insn))
PREV_INSN (NEXT_INSN (insn)) = PREV_INSN (insn);
}
if (GET_CODE (insn) == CODE_LABEL)
break;
insn = NEXT_INSN (insn);
}
if (bb->rbi->footer)
{
insn = BB_END (bb);
NEXT_INSN (insn) = bb->rbi->footer;
PREV_INSN (bb->rbi->footer) = insn;
while (NEXT_INSN (insn))
insn = NEXT_INSN (insn);
NEXT_INSN (insn) = next;
if (next)
PREV_INSN (next) = insn;
else
set_last_insn (insn);
}
}
if (bb->next_bb != EXIT_BLOCK_PTR)
to = &bb->next_bb->rbi->header;
else
to = &cfg_layout_function_footer;
rtl_delete_block (bb);
if (prev)
prev = NEXT_INSN (prev);
else
prev = get_insns ();
if (next)
next = PREV_INSN (next);
else
next = get_last_insn ();
if (next && NEXT_INSN (next) != prev)
{
remaints = unlink_insn_chain (prev, next);
insn = remaints;
while (NEXT_INSN (insn))
insn = NEXT_INSN (insn);
NEXT_INSN (insn) = *to;
if (*to)
PREV_INSN (*to) = insn;
*to = remaints;
}
} | false | false | false | false | false | 0 |
gc_menu_board_free(GcomprisBoard *board)
{
g_free(board->type);
g_free(board->mode);
g_free(board->name);
g_free(board->title);
g_free(board->description);
g_free(board->icon_name);
g_free(board->author);
g_free(board->boarddir);
g_free(board->filename);
g_free(board->difficulty);
g_free(board->mandatory_sound_file);
g_free(board->mandatory_sound_dataset);
g_free(board->section);
g_free(board->menuposition);
g_free(board->prerequisite);
g_free(board->goal);
g_free(board->manual);
g_free(board->credit);
if (board->gmodule)
g_module_close(board->gmodule);
g_free(board->gmodule_file);
g_free(board);
} | false | false | false | false | false | 0 |
betap(double phi, const void *a) {
double s2, *c, sum;
int i = MAX_C;
s2 = sin(phi);
s2 = s2 * s2;
c = A->CP + MAX_C;
sum = *--c;
while (--i) sum = *--c + s2 * sum;
return(cos(phi) * sum);
} | false | false | false | false | false | 0 |
findchar(char *str, int c)
{
while (*str)
{
if (t_iseq(str, c))
return str;
str += pg_mblen(str);
}
return NULL;
} | false | false | false | false | false | 0 |
svg_appearance_flag_dirty(u32 flags)
{
#if 1
/* fill-related */
if (flags & GF_SG_SVG_FILL_DIRTY) return 1;
if (flags & GF_SG_SVG_FILLOPACITY_DIRTY) return 1;
if (flags & GF_SG_SVG_FILLRULE_DIRTY) return 1;
/* stroke-related */
if (flags & GF_SG_SVG_STROKE_DIRTY) return 1;
if (flags & GF_SG_SVG_STROKEDASHARRAY_DIRTY) return 1;
if (flags & GF_SG_SVG_STROKEDASHOFFSET_DIRTY) return 1;
if (flags & GF_SG_SVG_STROKELINECAP_DIRTY) return 1;
if (flags & GF_SG_SVG_STROKELINEJOIN_DIRTY) return 1;
if (flags & GF_SG_SVG_STROKEMITERLIMIT_DIRTY) return 1;
if (flags & GF_SG_SVG_STROKEOPACITY_DIRTY) return 1;
if (flags & GF_SG_SVG_STROKEWIDTH_DIRTY) return 1;
if (flags & GF_SG_SVG_VECTOREFFECT_DIRTY) return 1;
/* gradients stops and solidcolor do not affect appearance directly */
return 0;
#else
if (flags &
(GF_SG_SVG_FILL_DIRTY | GF_SG_SVG_FILLOPACITY_DIRTY | GF_SG_SVG_FILLRULE_DIRTY
| GF_SG_SVG_STROKE_DIRTY | GF_SG_SVG_STROKEDASHARRAY_DIRTY
| GF_SG_SVG_STROKEDASHOFFSET_DIRTY | GF_SG_SVG_STROKELINECAP_DIRTY
| GF_SG_SVG_STROKELINEJOIN_DIRTY | GF_SG_SVG_STROKEMITERLIMIT_DIRTY
| GF_SG_SVG_STROKEOPACITY_DIRTY | GF_SG_SVG_STROKEWIDTH_DIRTY
| GF_SG_SVG_VECTOREFFECT_DIRTY) )
return 1;
return 0;
#endif
} | false | false | false | false | false | 0 |
slip_read(ifp, m)
struct interface *ifp;
struct message *m;
{
int n;
struct slippy *s;
CK_IFNULL(ifp);
CK_IFTYPE(ifp,IF_TYPE_SLIP);
CK_IFOPEN(ifp);
CK_MNULL(m);
s = (struct slippy *)ifp->private;
ifp->status &= ~IF_STAT_CALL_AGAIN;
m->length = 0;
for(;;){
if(s->bnext >= s->bcount){ /* we need more data! */
s->bnext = 0;
s->bcount = 0;
n = read(ifp->fd, (char *)s->buffer, MAX_SIZE);
if(n==0)return 0; /* got nothing */
if(n<0){
if(errno==EINTR)return 0; /* SIGHUP! */
if(errno==EWOULDBLOCK)return 0; /* got nothing */
PERR("read from tty device");
return -1;
}
s->bcount = n;
}
n = assemble_slip(s, s->buffer[s->bnext]);
s->bnext++;
if(n > 0){
(void)memcpy((char *)m->msg, (char *)s->ipacket, n);
m->length = n;
if(s->bnext < s->bcount)
ifp->status |= IF_STAT_CALL_AGAIN;
return n;
}
}
} | false | false | false | false | false | 0 |
player_quit()
{
// to let other player know a player quit voluntarily, not by error condition
err_when( id != MSG_PLAYER_QUIT );
// packet structure : <nation recno> <retire flag>
short *shortPtr = (short *)data_buf;
if( shortPtr[1])
news_array.multi_retire(*shortPtr);
else
news_array.multi_quit_game(*shortPtr);
} | false | false | false | false | true | 1 |
iigcd(long i1, long i2)
{
FULL f1, f2, temp;
f1 = (FULL) ((i1 >= 0) ? i1 : -i1);
f2 = (FULL) ((i2 >= 0) ? i2 : -i2);
while (f1) {
temp = f2 % f1;
f2 = f1;
f1 = temp;
}
return (long) f2;
} | false | false | false | false | false | 0 |
gee_read_only_sorted_set_real_sub_set (GeeSortedSet* base, gconstpointer from, gconstpointer to) {
GeeReadOnlySortedSet * self;
GeeSortedSet* result = NULL;
GeeCollection* _tmp0_ = NULL;
gconstpointer _tmp1_ = NULL;
gconstpointer _tmp2_ = NULL;
GeeSortedSet* _tmp3_ = NULL;
GeeSortedSet* _tmp4_ = NULL;
GeeSortedSet* _tmp5_ = NULL;
GeeSortedSet* _tmp6_ = NULL;
GeeSortedSet* _tmp7_ = NULL;
self = (GeeReadOnlySortedSet*) base;
_tmp0_ = ((GeeReadOnlyCollection*) self)->_collection;
_tmp1_ = from;
_tmp2_ = to;
_tmp3_ = gee_sorted_set_sub_set (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_SORTED_SET) ? ((GeeSortedSet*) _tmp0_) : NULL, _tmp1_, _tmp2_);
_tmp4_ = _tmp3_;
_tmp5_ = gee_sorted_set_get_read_only_view (_tmp4_);
_tmp6_ = _tmp5_;
_tmp7_ = _tmp6_;
_g_object_unref0 (_tmp4_);
result = _tmp7_;
return result;
} | false | false | false | false | false | 0 |
rfc822_dequote_comment (char *s)
{
char *w = s;
for (; *s; s++)
{
if (*s == '\\')
{
if (!*++s)
break; /* error? */
*w++ = *s;
}
else if (*s != '\"')
{
if (w != s)
*w = *s;
w++;
}
}
*w = 0;
} | false | false | false | false | false | 0 |
Pair_consistentp (int *ncanonical, struct T *pairs, int npairs, int cdna_direction) {
bool in_intron = false;
struct T *this;
int i;
*ncanonical = 0;
for (i = 0; i < npairs; i++) {
this = pairs++;
if (this->gapp) {
if (!in_intron) {
if (cdna_direction > 0) {
if (this->comp == REV_CANONICAL_INTRON_COMP ||
this->comp == REV_GCAG_INTRON_COMP ||
this->comp == REV_ATAC_INTRON_COMP) {
return false;
} else if (this->comp == FWD_CANONICAL_INTRON_COMP) {
(*ncanonical)++;
}
} else if (cdna_direction < 0) {
if (this->comp == FWD_CANONICAL_INTRON_COMP ||
this->comp == FWD_GCAG_INTRON_COMP ||
this->comp == FWD_ATAC_INTRON_COMP) {
return false;
} else if (this->comp == REV_CANONICAL_INTRON_COMP) {
(*ncanonical)++;
}
} else if (cdna_direction == 0) {
/* Set cdna_direction for next time */
if (this->comp == FWD_CANONICAL_INTRON_COMP ||
this->comp == FWD_GCAG_INTRON_COMP ||
this->comp == FWD_ATAC_INTRON_COMP) {
cdna_direction = +1;
} else if (this->comp == REV_CANONICAL_INTRON_COMP ||
this->comp == REV_GCAG_INTRON_COMP ||
this->comp == REV_ATAC_INTRON_COMP) {
cdna_direction = -1;
}
}
in_intron = true;
}
} else {
if (in_intron) {
in_intron = false;
}
}
}
return true;
} | false | false | false | false | false | 0 |
beginswith_helper (const gchar *ps1,
const gchar *ps2)
{
gchar *p, *res;
gchar *s1 = e_util_utf8_remove_accents (ps1);
gchar *s2 = e_util_utf8_remove_accents (ps2);
if ((p = (gchar *) e_util_utf8_strstrcase (s1, s2))
&& (p == s1))
res = (gchar *) ps1;
else
res = NULL;
g_free (s1);
g_free (s2);
return res;
} | false | false | false | false | false | 0 |
pipe_progress_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
{
char buf[PIPE_PROGRESS_SIZE];
time_t t = time(NULL);
int len;
while ((len = safe_read(STDIN_FILENO, buf, PIPE_PROGRESS_SIZE)) > 0) {
time_t new_time = time(NULL);
if (new_time != t) {
t = new_time;
bb_putchar_stderr('.');
}
full_write(STDOUT_FILENO, buf, len);
}
bb_putchar_stderr('\n');
return 0;
} | false | false | false | false | false | 0 |
Definition (ostream& out) {
const Coord* x;
const Coord* y;
int n;
ArrowSplineOvComp* comp = (ArrowSplineOvComp*) GetSubject();
n = comp->GetVertices()->GetOriginal(x, y);
ArrowOpenBSpline* aml = comp->GetArrowOpenBSpline();
float arrow_scale = aml->ArrowScale();
boolean head, tail;
head = comp->GetArrowOpenBSpline()->Head();
tail = comp->GetArrowOpenBSpline()->Tail();
out << Name() << "(";
Clipboard* cb = GetPtsList();
if (cb) {
out << " :pts " << MatchedPts(cb);
} else {
for (int i = 0; i < n; ) {
for (int j = 0; j < 10 && i < n; j++, i++) {
if (ptlist_parens())
out << "(" << x[i] << "," << y[i] << ")";
else
out << x[i] << "," << y[i];
if (i+1 < n ) out << ",";
}
if (i+1 < n ) {
out << "\n";
Indent(out);
}
}
}
if (arrow_scale != 1 )
out << " :arrowscale " << arrow_scale;
if (head)
out << " :head";
if (tail)
out << " :tail";
MinGS(out);
Annotation(out);
Attributes(out);
out << ")";
return out.good();
} | false | false | false | false | false | 0 |
_clean_effect_sequence(BD_IG_EFFECT_SEQUENCE *p)
{
unsigned ii;
for (ii = 0; ii < p->num_effects; ii++) {
_clean_effect(&p->effect[ii]);
}
X_FREE(p->effect);
X_FREE(p->window);
} | false | false | false | false | false | 0 |
write_one_cache_group(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
struct btrfs_path *path,
struct btrfs_block_group_cache *cache)
{
int ret;
struct btrfs_root *extent_root = root->fs_info->extent_root;
unsigned long bi;
struct extent_buffer *leaf;
ret = btrfs_search_slot(trans, extent_root, &cache->key, path, 0, 1);
if (ret) {
if (ret > 0)
ret = -ENOENT;
goto fail;
}
leaf = path->nodes[0];
bi = btrfs_item_ptr_offset(leaf, path->slots[0]);
write_extent_buffer(leaf, &cache->item, bi, sizeof(cache->item));
btrfs_mark_buffer_dirty(leaf);
fail:
btrfs_release_path(path);
return ret;
} | false | false | false | false | false | 0 |
static_export_seed (gamgi_cluster *cluster,
gamgi_polyhedron *polyhedron, int *n_polyhedrons, int *n_points,
gamgi_voronoi *voronoi)
{
if (polyhedron == NULL) return;
static_export_point (cluster, polyhedron->position, n_points);
*n_polyhedrons += 1;
} | 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.