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 |
|---|---|---|---|---|---|---|
__lambda73_ (BoxesProperties* self) {
BoxesLibvirtMachine* machine = NULL;
BoxesApp* _tmp0_ = NULL;
BoxesCollectionItem* _tmp1_ = NULL;
BoxesLibvirtMachine* _tmp2_ = NULL;
BoxesLibvirtMachine* _tmp3_ = NULL;
#line 295 "/extra-data/checkout/gnome/gnome-boxes/src/properties.vala"
_tmp0_ = boxes_app_app;
#line 295 "/extra-data/checkout/gnome/gnome-boxes/src/properties.vala"
_tmp1_ = _tmp0_->current_item;
#line 295 "/extra-data/checkout/gnome/gnome-boxes/src/properties.vala"
_tmp2_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp1_, BOXES_TYPE_LIBVIRT_MACHINE) ? ((BoxesLibvirtMachine*) _tmp1_) : NULL);
#line 295 "/extra-data/checkout/gnome/gnome-boxes/src/properties.vala"
machine = _tmp2_;
#line 296 "/extra-data/checkout/gnome/gnome-boxes/src/properties.vala"
_tmp3_ = machine;
#line 296 "/extra-data/checkout/gnome/gnome-boxes/src/properties.vala"
if (_tmp3_ != NULL) {
#line 1141 "properties.c"
BoxesLibvirtMachine* _tmp4_ = NULL;
#line 297 "/extra-data/checkout/gnome/gnome-boxes/src/properties.vala"
_tmp4_ = machine;
#line 297 "/extra-data/checkout/gnome/gnome-boxes/src/properties.vala"
boxes_libvirt_machine_force_shutdown (_tmp4_, TRUE);
#line 1147 "properties.c"
}
#line 294 "/extra-data/checkout/gnome/gnome-boxes/src/properties.vala"
_g_object_unref0 (machine);
#line 1151 "properties.c"
} | false | false | false | false | false | 0 |
run_shuffling_tool (data_shuffling_t *st)
{
GSList *cur;
GnmCell *cell;
int i, j;
if (st->type == SHUFFLE_COLS) {
/* Find empty space. */
for (i = gnm_sheet_get_last_col (st->sheet); i >= 0; i--)
for (j = gnm_sheet_get_last_row (st->sheet); j >= 0; j--) {
cell = sheet_cell_get (st->sheet, i, j);
if (cell != NULL)
break;
else if (gnm_sheet_get_max_rows (st->sheet) - j >= st->rows)
goto cols_out;
}
cols_out:
if (i < 0)
return;
range_init (&st->tmp_area, i, j, i, j + st->rows - 1);
for (cur = st->changes; cur; cur = cur->next)
do_swap_cols (st, (swap_t *) cur->data);
} else if (st->type == SHUFFLE_ROWS) {
/* Find empty space. */
for (i = gnm_sheet_get_last_row (st->sheet); i >= 0; i--)
for (j = gnm_sheet_get_last_col (st->sheet); j >= 0; j--) {
cell = sheet_cell_get (st->sheet, j, i);
if (cell != NULL)
break;
else if (gnm_sheet_get_max_cols (st->sheet) - j >= st->cols)
goto rows_out;
}
rows_out:
if (i < 0)
return;
range_init (&st->tmp_area, j, i, j + st->cols - 1, i);
for (cur = st->changes; cur; cur = cur->next)
do_swap_rows (st, (swap_t *) cur->data);
} else {
/* SHUFFLE_AREA */
/* Find empty space. */
for (i = gnm_sheet_get_last_col (st->sheet); i >= 0; i--)
for (j = gnm_sheet_get_last_row (st->sheet); j >= 0; j--) {
cell = sheet_cell_get (st->sheet, i, j);
if (cell == NULL)
goto area_out;
}
area_out:
if (i < 0)
return;
range_init (&st->tmp_area, i, j, i, j);
for (cur = st->changes; cur; cur = cur->next)
do_swap_cells (st, (swap_t *) cur->data);
}
} | false | false | false | false | false | 0 |
dns_sock_timer_cancel(int timer_id)
{
int i;
dns_sock_t *sock;
for (i = 0; i < NELEMS(SockPool); i++) {
sock = &SockPool[i];
if (sock->sock_timer.st_id == timer_id) {
plog(LOG_DEBUG, "%s: timer cancelled: sock = %p", MODULE, sock);
sock->sock_timer.st_timeout = 0;
dns_sock_free(sock);
}
}
} | false | false | false | false | false | 0 |
known_msg(num, id)
int num, id;
{
int i;
for(i = 0; i < msg_hdr[num].n_msg; i++)
if(msg_hdr[num].qt_msg[i].msgnum == id) return(TRUE);
return(FALSE);
} | false | false | false | false | false | 0 |
mc_setup_block_mode (Magicolor_Scanner *s)
{
/* block_len should always be a multiple of bytes_per_line, so
* we retrieve only whole lines at once */
s->block_len = (int)(0xff00/s->scan_bytes_per_line) * s->scan_bytes_per_line;
s->blocks = s->data_len / s->block_len;
s->last_len = s->data_len - (s->blocks * s->block_len);
if (s->last_len>0)
s->blocks++;
DBG(5, "%s: block_len=0x%x, last_len=0x%0x, blocks=%d\n", __func__, s->block_len, s->last_len, s->blocks);
s->counter = 0;
s->bytes_read_in_line = 0;
if (s->line_buffer)
free(s->line_buffer);
s->line_buffer = malloc(s->scan_bytes_per_line);
if (s->line_buffer == NULL) {
DBG(1, "out of memory (line %d)\n", __LINE__);
return SANE_STATUS_NO_MEM;
}
DBG (5, " %s: Setup block mode - scan_bytes_per_line=%d, pixels_per_line=%d, depth=%d, data_len=%x, block_len=%x, blocks=%d, last_len=%x\n",
__func__, s->scan_bytes_per_line, s->params.pixels_per_line, s->params.depth, s->data_len, s->block_len, s->blocks, s->last_len);
return SANE_STATUS_GOOD;
} | false | false | false | false | false | 0 |
print_equation_system_info (const equation_system *sys,
const DATASET *dset,
gretlopt opt, PRN *prn)
{
int header = (opt & OPT_H);
int i, vi, lag;
if (header && sys->name != NULL && !sys_anonymous(sys->name)) {
pprintf(prn, "%s %s\n", _("Equation system"), sys->name);
}
if (!header) {
for (i=0; i<sys->neqns; i++) {
print_system_equation(sys->lists[i], dset, prn);
}
}
for (i=0; i<sys->nidents; i++) {
print_system_identity(sys->idents[i], dset, opt, prn);
}
if (sys->ylist != NULL) {
pputs(prn, (header)? _("Endogenous variables:") : "endog");
for (i=1; i<=sys->ylist[0]; i++) {
vi = sys->ylist[i];
pprintf(prn, " %s", dset->varname[vi]);
}
pputc(prn, '\n');
}
if (header) {
if (sys->pre_vars != NULL) {
pputs(prn, _("Predetermined variables:"));
for (i=0; i<sys->plist[0]; i++) {
vi = sys->pre_vars[i].src;
lag = sys->pre_vars[i].lag;
pprintf(prn, " %s(-%d)", dset->varname[vi], lag);
}
pputc(prn, '\n');
}
if (sys->ilist != NULL && sys->ilist[0] > sys->plist[0]) {
pputs(prn, _("Exogenous variables:"));
for (i=1; i<=sys->ilist[0]; i++) {
vi = sys->ilist[i];
if (!in_gretl_list(sys->plist, vi)) {
pprintf(prn, " %s", dset->varname[vi]);
}
}
pputc(prn, '\n');
}
} else if (sys->ilist != NULL) {
pputs(prn, "instr");
for (i=1; i<=sys->ilist[0]; i++) {
vi = sys->ilist[i];
pprintf(prn, " %s", dset->varname[vi]);
}
pputc(prn, '\n');
}
} | false | false | false | false | false | 0 |
httpHeaderNoteParsedEntry(http_hdr_type id, String context, int error)
{
Headers[id].stat.parsCount++;
if (error) {
Headers[id].stat.errCount++;
debug(55, 2) ("cannot parse hdr field: '%s: %s'\n",
strBuf(Headers[id].name), strBuf(context));
}
} | false | false | false | false | false | 0 |
OrderFor(char *ident, int order)
{
if (! ordermap) {
ordermapmax = (nidents > TWENTY ? nidents : TWENTY) * 2;
/* Assume nidents read is indication of the No of
idents in the .aux file (*2 for good luck !) */
ordermap = xmalloc(ordermapmax * sizeof(struct order));
}
if (ordermapindex < ordermapmax) {
ordermap[ ordermapindex ].ident = copystring(ident);
ordermap[ ordermapindex ].order = order;
ordermapindex++;
} else {
Disaster("order map overflow");
}
} | false | false | false | false | false | 0 |
geda_settings_get_entries(GtkWidget *dialog, GedaSettings *geda)
{
geda->include_dir=update_str(geda->include_dir,
get_gtk_entry(dialog, "include_directory_entry"));
geda->gnetlist_command_line=update_str(geda->gnetlist_command_line,
get_gtk_entry(dialog, "gnetlist_command_line_entry"));
geda->attr=update_str(geda->attr, get_gtk_entry(dialog, "geda_labels_entry"));
geda->gschem_textsize=update_str(geda->gschem_textsize,
get_gtk_entry(dialog, "text_size_entry"));
geda->gschem_gridsize=update_str(geda->gschem_gridsize,
get_gtk_entry(dialog, "snap_size_entry"));
printf("%d",get_gtk_toggle_button(dialog, "includecwd_yes_radiobutton") );
if (get_gtk_toggle_button(dialog, "includecwd_yes_radiobutton") == TRUE)
geda->include_cwd=TRUE;
else
geda->include_cwd=FALSE;
if (get_gtk_toggle_button(dialog, "pinlabel_yes_radiobutton") == TRUE)
geda->pinlabel_attr=TRUE;
else
geda->pinlabel_attr=FALSE;
if (get_gtk_toggle_button(dialog, "netpriority_nodes_radiobutton") == TRUE)
geda->gnetlist_priority_node=TRUE;
else
geda->gnetlist_priority_node=FALSE;
if (get_gtk_toggle_button(dialog, "hierarchy_yes_radiobutton") == TRUE)
geda->gnetlist_hierarchy_allow=TRUE;
else
geda->gnetlist_hierarchy_allow=FALSE;
} | false | false | false | false | false | 0 |
r ( // r (theta)
size_t dimension_, // #(distinct values)
const Int4 *score_, // scores in increasing order
const double *prob_, // probability of corresponding value
double theta_) // argument of rate
// assumes logarithmic regime
{
double sum = 0.0;
for (size_t i = 0; i < dimension_; i++) {
sum += prob_ [i] * exp (theta_ * static_cast <double> (score_ [i]));
}
return sum;
} | false | false | false | false | false | 0 |
gm_worlds_view_finalize(GObject *object) {
GmWorldsView *obj = GM_WORLDS_VIEW(object);
GtkTreeModel *model = obj->priv->model;
GmWorld *list_world;
GtkTreeIter iter;
if (gtk_tree_model_get_iter_first(model, &iter)) {
do {
gtk_tree_model_get(model, &iter, GM_WORLDS_VIEW_WORLD_COLUMN,
&list_world, -1);
g_signal_handlers_disconnect_by_func(gm_world_options(list_world),
G_CALLBACK(on_gm_worlds_view_world_option_changed),
obj);
} while (gtk_tree_model_iter_next(model, &iter));
}
g_signal_handlers_disconnect_by_func(gm_app_instance(),
G_CALLBACK(on_gm_worlds_view_app_world_added), obj);
g_signal_handlers_disconnect_by_func(gm_app_instance(),
G_CALLBACK(on_gm_worlds_view_app_world_removed), obj);
G_OBJECT_CLASS(gm_worlds_view_parent_class)->finalize(object);
} | false | false | false | false | false | 0 |
efreet_default_dirs_get(const char *user_dir, Eina_List *system_dirs,
const char *suffix)
{
const char *xdg_dir;
char dir[PATH_MAX];
Eina_List *list = NULL;
Eina_List *l;
EINA_SAFETY_ON_NULL_RETURN_VAL(user_dir, NULL);
EINA_SAFETY_ON_NULL_RETURN_VAL(suffix, NULL);
snprintf(dir, sizeof(dir), "%s/%s", user_dir, suffix);
list = eina_list_append(list, eina_stringshare_add(dir));
EINA_LIST_FOREACH(system_dirs, l, xdg_dir)
{
snprintf(dir, sizeof(dir), "%s/%s", xdg_dir, suffix);
list = eina_list_append(list, eina_stringshare_add(dir));
}
return list;
} | false | false | false | false | false | 0 |
set_pkt_end_ptr (packetinfo *pi)
{
/* Paranoia! */
if (pi->pheader->len <= SNAPLENGTH) {
pi->end_ptr = (pi->packet + pi->pheader->len);
} else {
pi->end_ptr = (pi->packet + SNAPLENGTH);
}
return;
} | false | false | false | false | false | 0 |
write_word_data()
{
FILE *chewing_file;
FILE *char_file;
#ifdef USE_BINARY_DATA
FILE *index_begin_file;
FILE *index_phone_file;
unsigned char size;
#else
FILE *index_file;
#endif
int i;
uint16_t previous_phone;
int phone_num;
int pos;
chewing_file = fopen(CHEWING_DEFINITION_FILE, "w");
#ifdef USE_BINARY_DATA
index_begin_file = fopen(CHAR_INDEX_BEGIN_FILE, "wb");
index_phone_file = fopen(CHAR_INDEX_PHONE_FILE, "wb");
char_file = fopen(CHAR_FILE, "wb");
if (!(chewing_file && index_begin_file && index_phone_file && char_file)) {
fprintf(stderr, "Cannot open output file.\n");
exit(-1);
}
#else
index_file = fopen(CHAR_INDEX_FILE, "w");
char_file = fopen(CHAR_FILE, "w");
if (!(chewing_file && index_file && char_file)) {
fprintf(stderr, "Cannot open output file.\n");
exit(-1);
}
#endif
previous_phone = 0;
phone_num = 0;
for (i = 0; i < num_word_data; ++i) {
if (word_data[i].phone != previous_phone) {
previous_phone = word_data[i].phone;
pos = ftell(char_file);
#ifdef USE_BINARY_DATA
fwrite(&pos, sizeof(pos), 1, index_begin_file);
fwrite(&previous_phone, sizeof(previous_phone), 1, index_phone_file);
#else
fprintf(index_file, "%hu %d\n", previous_phone, pos);
#endif
phone_num++;
}
#ifdef USE_BINARY_DATA
size = strlen(word_data[ i ].word);
fwrite(&size, sizeof(size), 1, char_file);
fwrite(word_data[i].word, size, 1, char_file);
#else
fprintf(char_file, "%hu %s\t", word_data[i].phone, word_data[i].word);
#endif
}
pos = ftell(char_file);
#ifdef USE_BINARY_DATA
fwrite(&pos, sizeof(pos), 1, index_begin_file);
previous_phone = 0;
fwrite(&previous_phone, sizeof(previous_phone), 1, index_phone_file);
#else
fprintf(index_file, "0 %d\n", pos);
#endif
fprintf(chewing_file, "#define PHONE_NUM (%d)\n", phone_num);
fclose(char_file);
#ifdef USE_BINARY_DATA
fclose(index_phone_file);
fclose(index_begin_file);
#else
fclose(index_file);
#endif
fclose(chewing_file);
} | false | false | false | false | true | 1 |
drm_agp_acquire(struct drm_device * dev)
{
if (!dev->agp)
return -ENODEV;
if (dev->agp->acquired)
return -EBUSY;
if (!(dev->agp->bridge = agp_backend_acquire(dev->pdev)))
return -ENODEV;
dev->agp->acquired = 1;
return 0;
} | false | false | false | false | false | 0 |
open_policy_on_entry_event_after(GtkWidget * widget __attribute__ ((unused)), GdkEvent * event
__attribute__ ((unused)), gpointer user_data)
{
struct open_policy *op = (struct open_policy *)user_data;
gboolean sens = FALSE;
if (strcmp(gtk_entry_get_text(op->base_entry), "") != 0) {
sens = TRUE;
}
gtk_widget_set_sensitive(GTK_WIDGET(op->export_button), sens);
gtk_widget_set_sensitive(GTK_WIDGET(op->ok_button), sens);
} | false | false | false | false | false | 0 |
onscroll(GtkWidget *widget, GdkEventScroll *event, void *data)
{
if (event->direction == GDK_SCROLL_UP)
gli_input_handle_key(keycode_MouseWheelUp);
else if (event->direction == GDK_SCROLL_DOWN)
gli_input_handle_key(keycode_MouseWheelDown);
} | false | false | false | false | false | 0 |
G_Assign_Array(GVarElt *g_elem, WamWord *stc_adr, int array_op,
Bool backtrack, Bool copy)
{
WamWord word, tag_mask;
int arity;
Bool same_init_value;
WamWord init_word;
WamWord lst_word;
int new_size, size;
GVarElt *p;
int i;
arity = Arity(stc_adr);
DEREF(Arg(stc_adr, 0), word, tag_mask);
new_size = (tag_mask == TAG_LST_MASK) ? List_Length(word) :
UnTag_INT(word);
if (!(new_size > 0 && ((tag_mask == TAG_INT_MASK && arity <= 2) ||
(tag_mask == TAG_LST_MASK && arity == 1))))
Pl_Err_Domain(domain_g_array_index, Tag_STC(stc_adr));
if (tag_mask == TAG_INT_MASK)
{
same_init_value = TRUE;
init_word = (arity == 1) ? G_INITIAL_VALUE : Arg(stc_adr, 1);
}
else
{
same_init_value = FALSE;
lst_word = word;
}
if (array_op == G_ARRAY_EXTEND && g_elem->size >= 0)
array_op = G_ARRAY;
if (array_op != G_ARRAY_EXTEND && !backtrack)
{
G_Free_Element(g_elem, TRUE);
g_elem->size = 0;
}
size = -g_elem->size;
p = G_Alloc_Array(g_elem, new_size, backtrack);
if (array_op == G_ARRAY_EXTEND)
{
if (!same_init_value)
for(i = 0; i < size; i++) /* skip size 1st elems of list */
{
Get_List(lst_word);
init_word = Unify_Variable();
lst_word = Unify_Variable();
}
i = size;
p += size;
}
else
i = 0;
for (; i < new_size; i++)
{
if (!same_init_value)
{
Get_List(lst_word);
init_word = Unify_Variable();
lst_word = Unify_Variable();
}
p->size = 0;
p->val = G_INITIAL_VALUE;
p->undo = NULL;
G_Assign_Element(p++, init_word, FALSE, copy);
}
if (array_op == G_ARRAY_AUTO)
{
if (!same_init_value)
init_word = G_INITIAL_VALUE;
p->size = 0;
p->val = G_INITIAL_VALUE;
p->undo = NULL;
G_Assign_Element(p, init_word, FALSE, copy);
}
} | false | false | false | false | false | 0 |
in(Socket * sock, Socket * peersock, HTTPHeader * requestheader, HTTPHeader * docheader, bool runav, int *headersent)
{
//Socket *sock = where to read from
//Socket *peersock = browser to send stuff to for keeping it alive
//HTTPHeader *requestheader = header client used to request
//HTTPHeader *docheader = header used for sending first line of reply
//bool runav = to determine if limit is av or not
//int *headersent = to use to send the first line of header if needed
// or to mark that the header has already been sent
// so we know if we only partially downloaded from
// squid so later, if allowed, we can send the rest
bool toobig = false;
// match request to download manager so browsers potentially can have a prettier version
// and software updates, stream clients, etc. can have a compatible version.
int rc = 0;
# ifdef DGDEBUG
int j = 0;
#endif
for (std::deque<Plugin *>::iterator i = o.dmplugins_begin; i != o.dmplugins_end; i++) {
if ((i + 1) == o.dmplugins_end) {
#ifdef DGDEBUG
std::cerr << "Got to final download manager so defaulting to always match." << std::endl;
#endif
dm_plugin = (DMPlugin*)(*i);
rc = dm_plugin->in(this, sock, peersock, requestheader, docheader, runav, headersent, &toobig);
break;
} else {
if (((DMPlugin*)(*i))->willHandle(requestheader, docheader)) {
#ifdef DGDEBUG
std::cerr << "Matching download manager number: " << j << std::endl;
#endif
dm_plugin = (DMPlugin*)(*i);
rc = dm_plugin->in(this, sock, peersock, requestheader, docheader, runav, headersent, &toobig);
break;
}
}
#ifdef DGDEBUG
j++;
#endif
}
// we should check rc and log on error/warn
// note for later - Tue 16th November 2004
return toobig;
} | false | false | false | false | false | 0 |
rt2x00queue_create_tx_descriptor_plcp(struct rt2x00_dev *rt2x00dev,
struct sk_buff *skb,
struct txentry_desc *txdesc,
const struct rt2x00_rate *hwrate)
{
struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
struct ieee80211_tx_rate *txrate = &tx_info->control.rates[0];
unsigned int data_length;
unsigned int duration;
unsigned int residual;
/*
* Determine with what IFS priority this frame should be send.
* Set ifs to IFS_SIFS when the this is not the first fragment,
* or this fragment came after RTS/CTS.
*/
if (test_bit(ENTRY_TXD_FIRST_FRAGMENT, &txdesc->flags))
txdesc->u.plcp.ifs = IFS_BACKOFF;
else
txdesc->u.plcp.ifs = IFS_SIFS;
/* Data length + CRC + Crypto overhead (IV/EIV/ICV/MIC) */
data_length = skb->len + 4;
data_length += rt2x00crypto_tx_overhead(rt2x00dev, skb);
/*
* PLCP setup
* Length calculation depends on OFDM/CCK rate.
*/
txdesc->u.plcp.signal = hwrate->plcp;
txdesc->u.plcp.service = 0x04;
if (hwrate->flags & DEV_RATE_OFDM) {
txdesc->u.plcp.length_high = (data_length >> 6) & 0x3f;
txdesc->u.plcp.length_low = data_length & 0x3f;
} else {
/*
* Convert length to microseconds.
*/
residual = GET_DURATION_RES(data_length, hwrate->bitrate);
duration = GET_DURATION(data_length, hwrate->bitrate);
if (residual != 0) {
duration++;
/*
* Check if we need to set the Length Extension
*/
if (hwrate->bitrate == 110 && residual <= 30)
txdesc->u.plcp.service |= 0x80;
}
txdesc->u.plcp.length_high = (duration >> 8) & 0xff;
txdesc->u.plcp.length_low = duration & 0xff;
/*
* When preamble is enabled we should set the
* preamble bit for the signal.
*/
if (txrate->flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE)
txdesc->u.plcp.signal |= 0x08;
}
} | false | false | false | true | false | 1 |
Pull(vtkInformation *info)
{
vtkExecutiveSet eSet;
CollectUpstreamModules(this, eSet);
vtkExecutiveCollection *execs = vtkExecutiveCollection::New();
for (vtkExecutiveSet::iterator ti = eSet.begin(); ti != eSet.end(); ti++)
{
execs->AddItem(*ti);
}
vtkExecutionScheduler::GetGlobalScheduler()->Schedule(execs, info);
vtkExecutionScheduler::GetGlobalScheduler()->ReleaseResources(this);
vtkExecutionScheduler::GetGlobalScheduler()->WaitUntilDone(execs);
vtkExecutionScheduler::GetGlobalScheduler()->ReacquireResources(this);
execs->Delete();
} | false | false | false | false | false | 0 |
get_color_array (glColorHistoryModel *this,
guint *n_elements)
{
GVariant *value;
GVariant *child_value;
gsize i;
guint *array;
value = g_settings_get_value (this->priv->history, "recent-colors");
*n_elements = g_variant_n_children (value);
array = g_new0 (guint, *n_elements);
for ( i = 0; i < *n_elements; i++ )
{
child_value = g_variant_get_child_value (value, i);
array[i] = g_variant_get_uint32 (child_value);
g_variant_unref (child_value);
}
g_variant_unref (value);
return array;
} | false | false | false | false | false | 0 |
GWEN_XMLNode_GetCharValueByPath(GWEN_XMLNODE *n,
const char *name,
const char *defValue){
GWEN_XMLNODE *nn;
nn=GWEN_XMLNode_GetNodeByXPath(n, name, 0);
if (nn) {
GWEN_XMLNODE *dn;
dn=GWEN_XMLNode_GetFirstData(nn);
if (dn) {
if (dn->data)
return dn->data;
}
}
return defValue;
} | false | false | false | false | false | 0 |
build_ack(private_mode_config_t *this, message_t *message)
{
cp_payload_t *cp;
enumerator_t *enumerator;
host_t *host;
configuration_attribute_type_t type;
entry_t *entry;
cp = cp_payload_create_type(PLV1_CONFIGURATION, CFG_ACK);
/* return empty attributes for installed IPs */
enumerator = this->vips->create_enumerator(this->vips);
while (enumerator->enumerate(enumerator, &host))
{
type = INTERNAL_IP6_ADDRESS;
if (host->get_family(host) == AF_INET6)
{
type = INTERNAL_IP6_ADDRESS;
}
else
{
type = INTERNAL_IP4_ADDRESS;
}
cp->add_attribute(cp, configuration_attribute_create_chunk(
PLV1_CONFIGURATION_ATTRIBUTE, type, chunk_empty));
}
enumerator->destroy(enumerator);
enumerator = this->attributes->create_enumerator(this->attributes);
while (enumerator->enumerate(enumerator, &entry))
{
cp->add_attribute(cp,
configuration_attribute_create_chunk(PLV1_CONFIGURATION_ATTRIBUTE,
entry->type, chunk_empty));
}
enumerator->destroy(enumerator);
cp->set_identifier(cp, this->identifier);
message->add_payload(message, (payload_t*)cp);
return SUCCESS;
} | false | false | false | false | false | 0 |
pd6729_get_status(struct pcmcia_socket *sock, u_int *value)
{
struct pd6729_socket *socket
= container_of(sock, struct pd6729_socket, socket);
unsigned int status;
unsigned int data;
struct pd6729_socket *t;
/* Interface Status Register */
status = indirect_read(socket, I365_STATUS);
*value = 0;
if ((status & I365_CS_DETECT) == I365_CS_DETECT)
*value |= SS_DETECT;
/*
* IO cards have a different meaning of bits 0,1
* Also notice the inverse-logic on the bits
*/
if (indirect_read(socket, I365_INTCTL) & I365_PC_IOCARD) {
/* IO card */
if (!(status & I365_CS_STSCHG))
*value |= SS_STSCHG;
} else {
/* non I/O card */
if (!(status & I365_CS_BVD1))
*value |= SS_BATDEAD;
if (!(status & I365_CS_BVD2))
*value |= SS_BATWARN;
}
if (status & I365_CS_WRPROT)
*value |= SS_WRPROT; /* card is write protected */
if (status & I365_CS_READY)
*value |= SS_READY; /* card is not busy */
if (status & I365_CS_POWERON)
*value |= SS_POWERON; /* power is applied to the card */
t = (socket->number) ? socket : socket + 1;
indirect_write(t, PD67_EXT_INDEX, PD67_EXTERN_DATA);
data = indirect_read16(t, PD67_EXT_DATA);
*value |= (data & PD67_EXD_VS1(socket->number)) ? 0 : SS_3VCARD;
return 0;
} | false | false | false | false | false | 0 |
howNear(const Hep2Vector & p ) const {
double d = (*this - p).mag2();
double pdp = dot(p);
if ( (pdp > 0) && (d < pdp) ) {
return std::sqrt (d/pdp);
} else if ( (pdp == 0) && (d == 0) ) {
return 0;
} else {
return 1;
}
} | false | false | false | false | false | 0 |
GetRemoteDebuggingMap(cbProject* project)
{
if (!project)
project = m_pProject;
ProjectRemoteDebuggingMap::iterator it = m_RemoteDebugging.find(project);
if (it == m_RemoteDebugging.end()) // create an empty set for this project
it = m_RemoteDebugging.insert(m_RemoteDebugging.begin(), std::make_pair(project, RemoteDebuggingMap()));
return it->second;
} | false | false | false | false | false | 0 |
ves_icall_System_Reflection_Module_InternalGetTypes (MonoReflectionModule *module)
{
MonoArray *exceptions;
int i;
if (!module->image)
return mono_array_new (mono_object_domain (module), mono_defaults.monotype_class, 0);
else {
MonoArray *res = mono_module_get_types (mono_object_domain (module), module->image, &exceptions, FALSE);
for (i = 0; i < mono_array_length (exceptions); ++i) {
MonoException *ex = mono_array_get (exceptions, MonoException *, i);
if (ex) {
mono_set_pending_exception (ex);
return NULL;
}
}
return res;
}
} | false | false | false | false | false | 0 |
sshcom_encrypted(const Filename *filename, char **comment)
{
struct sshcom_key *key = load_sshcom_key(filename, NULL);
int pos, len, answer;
*comment = NULL;
if (!key)
return 0;
/*
* Check magic number.
*/
if (GET_32BIT(key->keyblob) != 0x3f6ff9eb)
return 0; /* key is invalid */
/*
* Find the cipher-type string.
*/
answer = 0;
pos = 8;
if (key->keyblob_len < pos+4)
goto done; /* key is far too short */
pos += 4 + GET_32BIT(key->keyblob + pos); /* skip key type */
if (key->keyblob_len < pos+4)
goto done; /* key is far too short */
len = GET_32BIT(key->keyblob + pos); /* find cipher-type length */
if (key->keyblob_len < pos+4+len)
goto done; /* cipher type string is incomplete */
if (len != 4 || 0 != memcmp(key->keyblob + pos + 4, "none", 4))
answer = 1;
done:
*comment = dupstr(key->comment);
memset(key->keyblob, 0, key->keyblob_size);
sfree(key->keyblob);
memset(key, 0, sizeof(*key));
sfree(key);
return answer;
} | false | false | false | false | false | 0 |
DtsFWFifoStatus(
HANDLE hDevice,
uint32_t *CpbSize,
uint32_t *CpbFullness
)
{
BC_STATUS sts = BC_STS_SUCCESS;
DecCmdChannelStatus *pCmd=NULL;
DecRspChannelStatus *pRsp = NULL;
DTS_LIB_CONTEXT *Ctx = NULL;
BC_IOCTL_DATA *pIocData = NULL;
DTS_GET_CTX(hDevice,Ctx);
if(Ctx->State == BC_DEC_STATE_CLOSE){
DebugLog_Trace(LDIL_DBG,"DtsFifoStatus: No Open Decoder\n");
return BC_STS_DEC_NOT_OPEN;
}
if(!CpbSize || !CpbFullness)
{
DebugLog_Trace(LDIL_DBG,"DtsFifoStatus: Invalid Args\n");
return BC_STS_INV_ARG;
}
if(!(pIocData = DtsAllocIoctlData(Ctx)))
return BC_STS_INSUFF_RES;
pCmd = (DecCmdChannelStatus *)&pIocData->u.fwCmd.cmd;
pCmd->command = eCMD_C011_DEC_CHAN_STATUS;
pCmd->sequence = ++Ctx->fwcmdseq;
pCmd->channelId = Ctx->OpenRsp.channelId;
if( (sts=DtsDrvCmd(Ctx,BCM_IOC_FW_CMD,1, pIocData, FALSE)) != BC_STS_SUCCESS){
DebugLog_Trace(LDIL_DBG,"DtsChannelStatus: Ioctl failed: %d\n",sts);
DtsRelIoctlData(Ctx,pIocData);
return sts;
}
pRsp = (DecRspChannelStatus*)&pIocData->u.fwCmd.rsp;
if(pRsp->status){
DebugLog_Trace(LDIL_DBG,"DtsChannelStatus: Failed %d\n",pRsp->status);
DtsRelIoctlData(Ctx,pIocData);
return BC_STS_FW_CMD_ERR;
}
*CpbSize = pRsp->cpbSize;
*CpbFullness = pRsp->cpbFullness;
DtsRelIoctlData(Ctx,pIocData);
return BC_STS_SUCCESS;
} | false | false | false | false | false | 0 |
cmd_name(int idx, char **cp) {
static char *kp;
static char fail[]="Keyword not found";
if (kp==NULL) kp = (char*) myallocz(80);
for (unsigned int i=0;i<NKEYS;i++) {
if (mkeywfn[i].index==idx) {
strcpy(kp,mkeywfn[i].word);
*cp = kp;
return;
}
}
*cp = &fail[0];
} | false | false | false | false | false | 0 |
convertOptLengthSpecC(ELObj *obj, const Identifier *ident,
const Location &loc,
FOTBuilder::OptLengthSpec &result)
{
obj = convertFromString(obj, convertAllowBoolean|convertAllowNumber, loc);
if (obj == makeFalse()) {
result.hasLength = 0;
return 1;
}
if (convertLengthSpecC(obj, ident, loc, result.length)) {
result.hasLength = 1;
return 1;
}
return 0;
} | false | false | false | false | false | 0 |
_k_canRead()
{
Q_Q(KPtyDevice);
qint64 readBytes = 0;
#ifdef Q_OS_IRIX // this should use a config define, but how to check it?
size_t available;
#else
int available;
#endif
if (!::ioctl(q->masterFd(), PTY_BYTES_AVAILABLE, (char *) &available)) {
#ifdef Q_OS_SOLARIS
// A Pty is a STREAMS module, and those can be activated
// with 0 bytes available. This happens either when ^C is
// pressed, or when an application does an explicit write(a,b,0)
// which happens in experiments fairly often. When 0 bytes are
// available, you must read those 0 bytes to clear the STREAMS
// module, but we don't want to hit the !readBytes case further down.
if (!available) {
char c;
// Read the 0-byte STREAMS message
NO_INTR(readBytes, read(q->masterFd(), &c, 0));
// Should return 0 bytes read; -1 is error
if (readBytes < 0) {
readNotifier->setEnabled(false);
emit q->readEof();
return false;
}
return true;
}
#endif
char *ptr = readBuffer.reserve(available);
#ifdef Q_OS_SOLARIS
// Even if available > 0, it is possible for read()
// to return 0 on Solaris, due to 0-byte writes in the stream.
// Ignore them and keep reading until we hit *some* data.
// In Solaris it is possible to have 15 bytes available
// and to (say) get 0, 0, 6, 0 and 9 bytes in subsequent reads.
// Because the stream is set to O_NONBLOCK in finishOpen(),
// an EOF read will return -1.
readBytes = 0;
while (!readBytes)
#endif
// Useless block braces except in Solaris
{
NO_INTR(readBytes, read(q->masterFd(), ptr, available));
}
if (readBytes < 0) {
readBuffer.unreserve(available);
q->setErrorString(i18n("Error reading from PTY"));
return false;
}
readBuffer.unreserve(available - readBytes); // *should* be a no-op
}
if (!readBytes) {
readNotifier->setEnabled(false);
emit q->readEof();
return false;
} else {
if (!emittedReadyRead) {
emittedReadyRead = true;
emit q->readyRead();
emittedReadyRead = false;
}
return true;
}
} | false | false | false | false | false | 0 |
pcm_sanity_check(struct snd_pcm_substream *substream)
{
struct snd_pcm_runtime *runtime;
if (PCM_RUNTIME_CHECK(substream))
return -ENXIO;
runtime = substream->runtime;
if (snd_BUG_ON(!substream->ops->copy && !runtime->dma_area))
return -EINVAL;
if (runtime->status->state == SNDRV_PCM_STATE_OPEN)
return -EBADFD;
return 0;
} | false | false | false | false | false | 0 |
g_dbus_create_reply_valist(DBusMessage *message,
int type, va_list args)
{
DBusMessage *reply;
reply = dbus_message_new_method_return(message);
if (reply == NULL)
return NULL;
if (dbus_message_append_args_valist(reply, type, args) == FALSE) {
dbus_message_unref(reply);
return NULL;
}
return reply;
} | false | false | false | false | false | 0 |
slapi_value_get_uint(const Slapi_Value *value)
{
if ( value == NULL ) return 0;
if ( value->bv_val == NULL ) return 0;
if ( !checkBVString( value ) ) return 0;
return (unsigned int)strtoul( value->bv_val, NULL, 10 );
} | false | false | false | false | false | 0 |
comp_GainTable(Task *task)
{
int i;
Array_def_use_table *lm_array;
Lms_pg *pg;
Block *bpt;
pg = &(task->hmdf_info->pg_head[task->SelectPro]);
lm_array = lms_get_all_array_on_pg(pg);
for (i = 1; i <= task->TaskNum; i++) {
if (!in_IntSet(task->TaskF, i)) {
Array_def_use_table *tmp;
tmp = copy_all_array_def_use_table(lm_array);
bpt = task->block[i];
intersect_array_def_use_table(&tmp, bpt->MayUse);
intersect_array_def_use_table(&tmp, bpt->MayMod);
task->GainTable[task->SelectPro][i]
= (real)get_array_du_estimated_size(tmp, bpt);
free_all_array_def_use_table(tmp);
}
}
} | false | false | false | false | false | 0 |
DoGetToken()
{
int start = m_TokenIndex;
bool needReplace = false;
wxString str;
wxChar c = CurrentChar();
if (c == '_' || wxIsalpha(c))
{
// keywords, identifiers, etc.
// operator== is cheaper than wxIsalnum, also MoveToNextChar already includes IsEOF
while ( ( (c == '_') || (wxIsalnum(c)) )
&& MoveToNextChar() )
c = CurrentChar(); // repeat
if (IsEOF())
return wxEmptyString;
needReplace = true;
str = m_Buffer.Mid(start, m_TokenIndex - start);
}
#ifdef __WXMSW__ // This is a Windows only bug!
// fetch non-English characters, see more details in: http://forums.codeblocks.org/index.php/topic,11387.0.html
else if (c == 178 || c == 179 || c == 185)
{
str = c;
MoveToNextChar();
}
#endif
else if (wxIsdigit(c))
{
// numbers
while (NotEOF() && CharInString(CurrentChar(), _T("0123456789.abcdefABCDEFXxLl")))
MoveToNextChar();
if (IsEOF())
return wxEmptyString;
str = m_Buffer.Mid(start, m_TokenIndex - start);
}
else if ( (c == '"') || (c == '\'') )
{
SkipString();
//Now, we are after the end of the C-string, so return the whole string as a token.
str = m_Buffer.Mid(start, m_TokenIndex - start);
}
else if (c == ':')
{
if (NextChar() == ':')
{
MoveToNextChar();
MoveToNextChar();
// this only copies a pointer, but operator= allocates memory and does a memcpy!
str.assign(TokenizerConsts::colon_colon);
}
else
{
MoveToNextChar();
str.assign(TokenizerConsts::colon);
}
}
else if (c == '<')
{
if (m_State&tsSingleAngleBrace)
{
if ( !SkipToOneOfChars( _T(">"), true, true) )
return wxEmptyString;
MoveToNextChar();
str= m_Buffer.Mid(start, m_TokenIndex - start);
}
else
{
str = c;
MoveToNextChar();
}
}
else if (c == '(')
{
if (m_State & tsReadRawExpression)
{
str = c;
MoveToNextChar();
}
else
{
ReadParentheses(str);
}
}
else
{
if (c == '{')
++m_NestLevel;
else if (c == '}')
--m_NestLevel;
str = c;
MoveToNextChar();
}
if (m_FirstRemainingLength != 0 && m_BufferLen - m_FirstRemainingLength < m_TokenIndex)
{
m_FirstRemainingLength = 0;
m_IsReplaceParsing = false;
m_RepeatReplaceCount = 0;
}
if (needReplace && m_State ^ tsReadRawExpression)
MacroReplace(str);
return str;
} | false | false | false | false | false | 0 |
drain(int4 node, int4 pid, int fd)
{
int4 list; /* trace list # */
int4 n_index, n_flags; /* node entry info */
int4 p_index, p_flags; /* pid entry info */
int4 r; /* length of traces ret'd */
int flush_delay; /* signal then delay */
/*
* Determine list number.
*/
if (ao_taken(op, "l")) {
ao_intparam(op, "l", 0, 0, &list);
} else {
list = TRANYLIST;
}
/*
* Determine flush delay.
*/
if (ao_taken(op, "f")) {
ao_intparam(op, "f", 0, 0, &flush_delay);
} else {
flush_delay = -1;
}
if (flush_delay >= 0) {
if (fl_verbose) nodespin_init("delivering flush signal,");
do {
do {
if (fl_verbose) nodespin_next(node);
if (pid == TRANYPID) {
if (rpdoom(node, SELECT_APPL, 0, LAM_SIGTRACE))
lamfail("lamtrace (rpdoom)");
} else {
if (rpdoom(node, SELECT_PID, pid, LAM_SIGTRACE))
lamfail("lamtrace (rpdoom)");
}
nid_get(&n_index, &node, &n_flags);
} while (n_index);
pid_get(&p_index, &pid, &p_flags);
} while (p_index > 0);
if (flush_delay > 0) {
sleep((unsigned) flush_delay);
}
if (fl_verbose) nodespin_end();
}
if (fl_verbose) nodespin_init("draining traces,");
do {
do {
if (fl_verbose) nodespin_next(node);
if (ao_taken(op, "k")) {
r = lam_rtrfget(node, list, pid, fd);
if (r < 0) lamfail("lamtrace (lam_rtrfget)");
} else {
r = lam_rtrfforget(node, list, pid, fd);
if (r < 0) lamfail("lamtrace (lam_rtrfget)");
}
nid_get(&n_index, &node, &n_flags);
} while (n_index);
pid_get(&p_index, &pid, &p_flags);
} while (p_index > 0);
if (fl_verbose) nodespin_end();
} | false | false | false | false | false | 0 |
sendservermode(bool send = true)
{
int sm = (autoteam ? AT_ENABLED : AT_DISABLED) | ((mastermode & MM_MASK) << 2) | (matchteamsize << 4);
if(send) sendf(-1, 1, "ri2", SV_SERVERMODE, sm);
return sm;
} | false | false | false | false | false | 0 |
goo_canvas_set_static_root_item_model (GooCanvas *canvas,
GooCanvasItemModel *model)
{
GooCanvasPrivate *priv;
g_return_if_fail (GOO_IS_CANVAS (canvas));
g_return_if_fail (GOO_IS_CANVAS_ITEM_MODEL (model));
priv = GOO_CANVAS_GET_PRIVATE (canvas);
if (priv->static_root_item_model == model)
return;
if (priv->static_root_item_model)
{
g_object_unref (priv->static_root_item_model);
priv->static_root_item_model = NULL;
}
if (priv->static_root_item)
{
g_object_unref (priv->static_root_item);
priv->static_root_item = NULL;
}
if (model)
{
priv->static_root_item_model = g_object_ref (model);
/* Create a hierarchy of canvas items for all the items in the model. */
priv->static_root_item = goo_canvas_create_item (canvas, model);
}
else
{
/* The model has been reset so we go back to a default root group. */
priv->static_root_item = goo_canvas_group_new (NULL, NULL);
}
goo_canvas_item_set_canvas (priv->static_root_item, canvas);
goo_canvas_item_set_is_static (priv->static_root_item, TRUE);
canvas->need_update = TRUE;
#if GTK_CHECK_VERSION(2, 19, 0)
if (gtk_widget_get_realized (GTK_WIDGET(canvas)))
#else
if (GTK_WIDGET_REALIZED (canvas))
#endif
goo_canvas_update (canvas);
gtk_widget_queue_draw (GTK_WIDGET (canvas));
} | false | false | false | false | false | 0 |
VerifyDescriptors(void)
{
struct stat statBuf;
if ((fstat(STDIN_FILENO, &statBuf) < 0) ||
(fstat(STDOUT_FILENO, &statBuf) < 0) ||
(fstat(STDERR_FILENO, &statBuf) < 0))
{
_exit(99);
}
} | false | false | false | false | false | 0 |
retrocl_housekeeping ( time_t cur_time, void *noarg )
{
int ldrc;
if (retrocl_be_changelog == NULL) {
LDAPDebug0Args(LDAP_DEBUG_TRACE,"not housekeeping if no cl be\n");
return;
}
if ( !ts.ts_s_initialized ) {
slapi_log_error( SLAPI_LOG_FATAL, RETROCL_PLUGIN_NAME, "changelog_housekeeping called before "
"trimming constraints set\n" );
return;
}
PR_Lock( ts.ts_s_trim_mutex );
if ( !ts.ts_s_trimming ) {
int must_trim = 0;
/* See if we need to trim */
/* Has enough time elapsed since our last check? */
if ( cur_time - ts.ts_s_last_trim >= (ts.ts_c_max_age) ) {
/* Is the first entry too old? */
time_t first_time;
/*
* good we could avoid going to the database to retrieve
* this time information if we cached the last value we'd read.
* But a client might have deleted it over protocol.
*/
first_time = retrocl_getchangetime( SLAPI_SEQ_FIRST, &ldrc );
LDAPDebug(LDAP_DEBUG_PLUGIN,
"cltrim: ldrc=%d, first_time=%ld, cur_time=%ld\n",
ldrc,first_time,cur_time);
if ( LDAP_SUCCESS == ldrc && first_time > (time_t) 0L &&
first_time + ts.ts_c_max_age < cur_time ) {
must_trim = 1;
}
}
if ( must_trim ) {
LDAPDebug0Args(LDAP_DEBUG_TRACE,"changelog about to create thread\n");
/* Start a thread to trim the changelog */
ts.ts_s_trimming = 1;
if ( PR_CreateThread( PR_USER_THREAD,
changelog_trim_thread_fn, NULL,
PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, PR_UNJOINABLE_THREAD,
RETROCL_DLL_DEFAULT_THREAD_STACKSIZE ) == NULL ) {
slapi_log_error( SLAPI_LOG_FATAL, RETROCL_PLUGIN_NAME, "unable to create changelog trimming thread\n" );
}
} else {
LDAPDebug0Args(LDAP_DEBUG_PLUGIN,
"changelog does not need to be trimmed\n");
}
}
PR_Unlock( ts.ts_s_trim_mutex );
} | false | false | false | false | false | 0 |
caribou_column_model_first_key (CaribouColumnModel* self) {
CaribouKeyModel* result = NULL;
GeeArrayList* _tmp0_ = NULL;
gpointer _tmp1_ = NULL;
g_return_val_if_fail (self != NULL, NULL);
_tmp0_ = self->priv->keys;
_tmp1_ = gee_list_first ((GeeList*) _tmp0_);
result = (CaribouKeyModel*) _tmp1_;
return result;
} | false | false | false | false | false | 0 |
get_bytes(struct tdb_context *tdb,
tdb1_off_t off, tdb1_len_t len)
{
TDB_DATA d;
d.dsize = len;
if (tdb->tdb1.transaction == NULL && tdb->file->map_ptr != NULL)
d.dptr = (unsigned char *)tdb->file->map_ptr + off;
else
d.dptr = tdb1_alloc_read(tdb, off, d.dsize);
return d;
} | false | false | false | false | false | 0 |
format_humanmem(char *buf, size_t len, unsigned long mem)
{
if (mem >= 1024*1024)
snprintf(buf, len, "%4.2fGB", (float)mem/(1024*1024));
else if (mem >= 1024)
snprintf(buf, len, "%4.2fMB", (float)mem/1024);
else
snprintf(buf, len, "%4.2fkB", (float)mem);
return buf;
} | false | false | false | false | false | 0 |
on_camera_added (EmpathyCameraDeviceMonitor *device,
gchar *id,
gchar *filename,
gchar *product_name,
gint api_version,
EmpathyCameraMonitor *self)
{
EmpathyCamera *camera;
if (self->priv->cameras == NULL)
return;
camera = empathy_camera_new (id, filename, product_name);
g_queue_push_tail (self->priv->cameras, camera);
self->priv->num_cameras++;
if (self->priv->num_cameras == 1)
g_object_notify (G_OBJECT (self), "available");
g_signal_emit (self, signals[CAMERA_ADDED], 0, camera);
} | false | false | false | false | false | 0 |
getPropertySubset(
const tstring& prefix) const
{
Properties ret;
std::vector<tstring> const keys = propertyNames();
size_t const prefix_len = prefix.size ();
for (std::vector<tstring>::const_iterator it = keys.begin();
it != keys.end(); ++it)
{
int result = it->compare (0, prefix_len, prefix);
if (result == 0)
ret.setProperty (it->substr (prefix_len), getProperty(*it));
}
return ret;
} | false | false | false | false | false | 0 |
vm_matrix_cmp( matrix * a, matrix * b )
{
float tmp1,tmp2,tmp3;
tmp1 = fl_abs(vm_vec_dot( &a->vec.uvec, &b->vec.uvec ) - 1.0f);
tmp2 = fl_abs(vm_vec_dot( &a->vec.fvec, &b->vec.fvec ) - 1.0f);
tmp3 = fl_abs(vm_vec_dot( &a->vec.rvec, &b->vec.rvec ) - 1.0f);
// mprintf(( "Mat=%.16f, %.16f, %.16f\n", tmp1, tmp2, tmp3 ));
if ( tmp1 > 0.0000005f ) return 1;
if ( tmp2 > 0.0000005f ) return 1;
if ( tmp3 > 0.0000005f ) return 1;
return 0;
} | false | false | false | false | false | 0 |
Ns_RWLockUnlock(Ns_RWLock *rwPtr)
{
RwLock *lockPtr = (RwLock *) *rwPtr;
Ns_MutexLock(&lockPtr->mutex);
if (--lockPtr->lockcnt < 0) {
lockPtr->lockcnt = 0;
}
if (lockPtr->nwriters) {
Ns_CondSignal(&lockPtr->wcond);
} else if (lockPtr->nreaders) {
Ns_CondBroadcast(&lockPtr->rcond);
}
Ns_MutexUnlock (&lockPtr->mutex);
} | false | false | false | false | false | 0 |
gfire_process_list_clear(gfire_process_list *p_list)
{
if(!p_list)
return;
while(p_list->processes)
{
gfire_process_info_free((process_info*)p_list->processes->data);
p_list->processes = g_list_delete_link(p_list->processes, p_list->processes);
}
} | false | false | false | false | false | 0 |
UIntDec(struct Expression * exp, struct Operand * op1)
{
exp->type = 2;
exp->string = PrintUInt((--op1->ui));
if(!exp->expType)
{
exp->expType = op1->type;
if(op1->type)
op1->type->refCount++;
}
return 0x1;
} | false | false | false | false | false | 0 |
_theme_hook(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
const char *t;
evas_event_freeze(evas_object_evas_get(obj));
_elm_widget_mirrored_reload(obj);
_mirrored_set(obj, elm_widget_mirrored_get(obj));
t = eina_stringshare_add(elm_object_text_get(obj));
_elm_theme_object_set(obj, wd->ent, "entry", _getbase(obj), elm_widget_style_get(obj));
if (_elm_config->desktop_entry)
edje_object_part_text_select_allow_set(wd->ent, "elm.text", EINA_TRUE);
elm_object_text_set(obj, t);
eina_stringshare_del(t);
if (elm_widget_disabled_get(obj))
edje_object_signal_emit(wd->ent, "elm,state,disabled", "elm");
edje_object_part_text_input_panel_layout_set(wd->ent, "elm.text", wd->input_panel_layout);
edje_object_part_text_autocapital_type_set(wd->ent, "elm.text", wd->autocapital_type);
edje_object_part_text_prediction_allow_set(wd->ent, "elm.text", wd->prediction_allow);
edje_object_part_text_input_panel_enabled_set(wd->ent, "elm.text", wd->input_panel_enable);
edje_object_part_text_input_panel_imdata_set(wd->ent, "elm.text", wd->input_panel_imdata, wd->input_panel_imdata_len);
edje_object_part_text_input_panel_return_key_type_set(wd->ent, "elm.text", wd->input_panel_return_key_type);
edje_object_part_text_input_panel_return_key_disabled_set(wd->ent, "elm.text", wd->input_panel_return_key_disabled);
if (wd->cursor_pos != 0)
elm_entry_cursor_pos_set(obj, wd->cursor_pos);
if (elm_widget_focus_get(obj))
edje_object_signal_emit(wd->ent, "elm,action,focus", "elm");
edje_object_message_signal_process(wd->ent);
edje_object_scale_set(wd->ent, elm_widget_scale_get(obj) * _elm_config->scale);
if (wd->scroll)
{
const char *str;
Evas_Object *edj;
elm_smart_scroller_mirrored_set(wd->scroller, elm_widget_mirrored_get(obj));
elm_smart_scroller_object_theme_set(obj, wd->scroller, "scroller", "entry",
elm_widget_style_get(obj));
edj = elm_smart_scroller_edje_object_get(wd->scroller);
str = edje_object_data_get(edj, "focus_highlight");
if ((str) && (!strcmp(str, "on")))
elm_widget_highlight_in_theme_set(obj, EINA_TRUE);
else
elm_widget_highlight_in_theme_set(obj, EINA_FALSE);
}
_sizing_eval(obj);
wd->havetext = !wd->havetext;
_elm_entry_update_guide(obj, !wd->havetext);
evas_event_thaw(evas_object_evas_get(obj));
evas_event_thaw_eval(evas_object_evas_get(obj));
} | false | false | false | false | false | 0 |
output_tfm(Metrics &metrics, const String &ps_name, int boundary_char,
const FontInfo &finfo, String tfm_filename, String vf_filename,
ErrorHandler *errh)
{
String pl_filename;
bool vpl = vf_filename;
if (no_create) {
errh->message("would write %s to temporary file", (vpl ? "VPL" : "PL"));
pl_filename = "<temporary>";
} else {
int pl_fd = temporary_file(pl_filename, errh);
if (pl_fd < 0)
return;
output_pl(metrics, ps_name, boundary_char, finfo, vpl, pl_filename, errh);
close(pl_fd);
}
StringAccum command;
if (vpl)
command << "vptovf " << shell_quote(pl_filename) << ' ' << shell_quote(vf_filename) << ' ' << shell_quote(tfm_filename) << " >&2";
else
command << "pltotf " << shell_quote(pl_filename) << ' ' << shell_quote(tfm_filename) << " >&2";
int status = mysystem(command.c_str(), errh);
if (!no_create)
unlink(pl_filename.c_str());
if (status != 0)
errh->fatal("%s execution failed", (vpl ? "vptovf" : "pltotf"));
else {
update_odir(O_TFM, tfm_filename, errh);
if (vpl)
update_odir(O_VF, vf_filename, errh);
}
} | false | false | false | false | false | 0 |
slapi_rdn_partial_dup(Slapi_RDN *from, Slapi_RDN **to, int rdnidx)
{
char **ptr = NULL;
int lastidx = -1;
if (NULL == from || NULL == to || rdnidx < 0)
{
return -1;
}
*to = NULL;
for (ptr = from->all_rdns; ptr && *ptr; ptr++) lastidx++;
if (rdnidx > lastidx)
{
return -1;
}
if (NULL == from->all_nrdns)
{
from->all_nrdns = charray_dup(from->all_rdns);
for (ptr = from->all_nrdns; ptr && *ptr; ptr++)
{
normalize_case_helper(NULL, ptr);
}
}
*to = slapi_rdn_new();
(*to)->rdn = slapi_ch_strdup(from->all_rdns[rdnidx]);
(*to)->nrdn = slapi_ch_strdup(from->all_nrdns[rdnidx]);
(*to)->all_rdns = charray_dup(&(from->all_rdns[rdnidx]));
(*to)->all_nrdns = charray_dup(&(from->all_nrdns[rdnidx]));
return 0;
} | false | false | false | true | false | 1 |
calculate_exposures(int x, int y, int z)
{
int e = 0;
if (z == GRID_SZ-1)
return 0;
if (grid[x+1][y+1][z+1]) e++;
if (grid[x-1][y+1][z+1]) e++;
if (grid[x+1][y-1][z+1]) e++;
if (grid[x-1][y-1][z+1]) e++;
if (grid[x-1][y][z+1]) e+=2;
if (grid[x+1][y][z+1]) e+=2;
if (grid[x][y-1][z+1]) e+=2;
if (grid[x][y+1][z+1]) e+=2;
if (grid[x][y][z+1]) e+=4;
return e;
} | false | false | false | false | false | 0 |
quota_readlink (call_frame_t *frame, xlator_t *this, loc_t *loc, size_t size)
{
quota_local_t *local = NULL;
int32_t ret = -1;
local = quota_local_new ();
if (local == NULL) {
goto unwind;
}
frame->local = local;
ret = loc_copy (&local->loc, loc);
if (ret < 0) {
gf_log (this->name, GF_LOG_WARNING, "loc_copy failed");
goto unwind;
}
STACK_WIND (frame, quota_readlink_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->readlink, loc, size);
return 0;
unwind:
QUOTA_STACK_UNWIND (readlink, frame, -1, ENOMEM, NULL, NULL);
return 0;
} | false | false | false | false | true | 1 |
wire_ttl_to_str(rrset_dump_params_t *p)
{
uint32_t data;
size_t in_len = sizeof(data);
size_t out_len = 0;
int ret;
p->ret = -1;
// Check input size.
if (in_len > p->in_max) {
return;
}
// Fill in input data.
if (memcpy(&data, p->in, in_len) == NULL) {
return;
}
if (p->style->human_ttl) {
// Write time in human readable format.
ret = time_to_human_str(p->out, p->out_max, ntohl(data));
if (ret <= 0) {
return;
}
} else {
// Write timestamp only.
ret = snprintf(p->out, p->out_max, "%u", ntohl(data));
if (ret <= 0 || (size_t)ret >= p->out_max) {
return;
}
}
out_len = ret;
// Fill in output.
p->in += in_len;
p->in_max -= in_len;
p->out += out_len;
p->out_max -= out_len;
p->total += out_len;
p->ret = 0;
} | false | true | false | false | false | 1 |
radeon_wb_init(struct radeon_device *rdev)
{
int r;
if (rdev->wb.wb_obj == NULL) {
r = radeon_bo_create(rdev, RADEON_GPU_PAGE_SIZE, PAGE_SIZE, true,
RADEON_GEM_DOMAIN_GTT, 0, NULL, NULL,
&rdev->wb.wb_obj);
if (r) {
dev_warn(rdev->dev, "(%d) create WB bo failed\n", r);
return r;
}
r = radeon_bo_reserve(rdev->wb.wb_obj, false);
if (unlikely(r != 0)) {
radeon_wb_fini(rdev);
return r;
}
r = radeon_bo_pin(rdev->wb.wb_obj, RADEON_GEM_DOMAIN_GTT,
&rdev->wb.gpu_addr);
if (r) {
radeon_bo_unreserve(rdev->wb.wb_obj);
dev_warn(rdev->dev, "(%d) pin WB bo failed\n", r);
radeon_wb_fini(rdev);
return r;
}
r = radeon_bo_kmap(rdev->wb.wb_obj, (void **)&rdev->wb.wb);
radeon_bo_unreserve(rdev->wb.wb_obj);
if (r) {
dev_warn(rdev->dev, "(%d) map WB bo failed\n", r);
radeon_wb_fini(rdev);
return r;
}
}
/* clear wb memory */
memset((char *)rdev->wb.wb, 0, RADEON_GPU_PAGE_SIZE);
/* disable event_write fences */
rdev->wb.use_event = false;
/* disabled via module param */
if (radeon_no_wb == 1) {
rdev->wb.enabled = false;
} else {
if (rdev->flags & RADEON_IS_AGP) {
/* often unreliable on AGP */
rdev->wb.enabled = false;
} else if (rdev->family < CHIP_R300) {
/* often unreliable on pre-r300 */
rdev->wb.enabled = false;
} else {
rdev->wb.enabled = true;
/* event_write fences are only available on r600+ */
if (rdev->family >= CHIP_R600) {
rdev->wb.use_event = true;
}
}
}
/* always use writeback/events on NI, APUs */
if (rdev->family >= CHIP_PALM) {
rdev->wb.enabled = true;
rdev->wb.use_event = true;
}
dev_info(rdev->dev, "WB %sabled\n", rdev->wb.enabled ? "en" : "dis");
return 0;
} | false | false | false | false | false | 0 |
_dictExpandIfNeeded(dict *d)
{
/* Incremental rehashing already in progress. Return. */
if (dictIsRehashing(d)) return DICT_OK;
/* If the hash table is empty expand it to the intial size. */
if (d->ht[0].size == 0) return dictExpand(d, DICT_HT_INITIAL_SIZE);
/* If we reached the 1:1 ratio, and we are allowed to resize the hash
* table (global setting) or we should avoid it but the ratio between
* elements/buckets is over the "safe" threshold, we resize doubling
* the number of buckets. */
if (d->ht[0].used >= d->ht[0].size &&
(dict_can_resize ||
d->ht[0].used/d->ht[0].size > dict_force_resize_ratio))
{
return dictExpand(d, ((d->ht[0].size > d->ht[0].used) ?
d->ht[0].size : d->ht[0].used)*2);
}
return DICT_OK;
} | false | false | false | false | false | 0 |
payloader_filter (GstPluginFeature * feature, FilterData * data)
{
gboolean res;
const gchar *klass;
GstElementFactory *fact;
GList **list = NULL;
/* we only care about element factories */
if (G_UNLIKELY (!GST_IS_ELEMENT_FACTORY (feature)))
return FALSE;
if (gst_plugin_feature_get_rank (feature) < GST_RANK_MARGINAL)
return FALSE;
fact = GST_ELEMENT_FACTORY_CAST (feature);
klass = gst_element_factory_get_klass (fact);
if (strstr (klass, "Decoder"))
list = &data->decode;
else if (strstr (klass, "Demux"))
list = &data->demux;
else if (strstr (klass, "Parser") && strstr (klass, "Codec"))
list = &data->demux;
else if (strstr (klass, "Payloader") && strstr (klass, "RTP"))
list = &data->payload;
if (list) {
GST_DEBUG ("adding %s", GST_PLUGIN_FEATURE_NAME (fact));
*list = g_list_prepend (*list, fact);
}
return FALSE;
} | false | false | false | false | false | 0 |
parseAttribute(AttributeImpl *attr)
{
switch ( attr->id() )
{
case ATTR_TYPE:
case ATTR_CODETYPE:
if (attr->val()) {
setServiceType(attr->val()->string());
setNeedComputeContent();
}
break;
case ATTR_WIDTH:
if (!attr->value().isEmpty())
addCSSLength(CSS_PROP_WIDTH, attr->value());
else
removeCSSProperty(CSS_PROP_WIDTH);
break;
case ATTR_HEIGHT:
if (!attr->value().isEmpty())
addCSSLength(CSS_PROP_HEIGHT, attr->value());
else
removeCSSProperty(CSS_PROP_HEIGHT);
break;
case ATTR_NAME:
if (inDocument() && m_name != attr->value()) {
document()->underDocNamedCache().remove(m_name, this);
document()->underDocNamedCache().add (attr->value(), this);
}
m_name = attr->value();
//fallthrough
default:
HTMLElementImpl::parseAttribute( attr );
}
} | false | false | false | false | false | 0 |
generate (CProject &project, Unit *unit) {
string include_directive;
// get the name, which we have to use to include the file
Filename include_file = project.getInclString (unit->name ());
include_directive += "#include \"";
include_directive += include_file.name ();
include_directive += "\"";
return include_directive;
} | false | false | false | false | false | 0 |
gp2ap020a00f_read_channel(struct gp2ap020a00f_data *data,
struct iio_chan_spec const *chan, int *val)
{
enum gp2ap020a00f_cmd cmd;
int err;
switch (chan->scan_index) {
case GP2AP020A00F_SCAN_MODE_LIGHT_CLEAR:
cmd = GP2AP020A00F_CMD_READ_RAW_CLEAR;
break;
case GP2AP020A00F_SCAN_MODE_LIGHT_IR:
cmd = GP2AP020A00F_CMD_READ_RAW_IR;
break;
case GP2AP020A00F_SCAN_MODE_PROXIMITY:
cmd = GP2AP020A00F_CMD_READ_RAW_PROXIMITY;
break;
default:
return -EINVAL;
}
err = gp2ap020a00f_exec_cmd(data, cmd);
if (err < 0) {
dev_err(&data->client->dev,
"gp2ap020a00f_exec_cmd failed\n");
goto error_ret;
}
err = gp2ap020a00f_read_output(data, chan->address, val);
if (err < 0)
dev_err(&data->client->dev,
"gp2ap020a00f_read_output failed\n");
err = gp2ap020a00f_set_operation_mode(data,
GP2AP020A00F_OPMODE_SHUTDOWN);
if (err < 0)
dev_err(&data->client->dev,
"Failed to shut down the device.\n");
if (cmd == GP2AP020A00F_CMD_READ_RAW_CLEAR ||
cmd == GP2AP020A00F_CMD_READ_RAW_IR)
gp2ap020a00f_output_to_lux(data, val);
error_ret:
return err;
} | false | false | false | false | false | 0 |
__ptrace_unlink(struct task_struct *child)
{
const struct cred *old_cred;
BUG_ON(!child->ptrace);
child->ptrace = 0;
child->parent = child->real_parent;
list_del_init(&child->ptrace_entry);
old_cred = child->ptracer_cred;
child->ptracer_cred = NULL;
put_cred(old_cred);
spin_lock(&child->sighand->siglock);
/*
* Clear all pending traps and TRAPPING. TRAPPING should be
* cleared regardless of JOBCTL_STOP_PENDING. Do it explicitly.
*/
task_clear_jobctl_pending(child, JOBCTL_TRAP_MASK);
task_clear_jobctl_trapping(child);
/*
* Reinstate JOBCTL_STOP_PENDING if group stop is in effect and
* @child isn't dead.
*/
if (!(child->flags & PF_EXITING) &&
(child->signal->flags & SIGNAL_STOP_STOPPED ||
child->signal->group_stop_count)) {
child->jobctl |= JOBCTL_STOP_PENDING;
/*
* This is only possible if this thread was cloned by the
* traced task running in the stopped group, set the signal
* for the future reports.
* FIXME: we should change ptrace_init_task() to handle this
* case.
*/
if (!(child->jobctl & JOBCTL_STOP_SIGMASK))
child->jobctl |= SIGSTOP;
}
/*
* If transition to TASK_STOPPED is pending or in TASK_TRACED, kick
* @child in the butt. Note that @resume should be used iff @child
* is in TASK_TRACED; otherwise, we might unduly disrupt
* TASK_KILLABLE sleeps.
*/
if (child->jobctl & JOBCTL_STOP_PENDING || task_is_traced(child))
ptrace_signal_wake_up(child, true);
spin_unlock(&child->sighand->siglock);
} | false | false | false | false | false | 0 |
no_response_to_proxied_request(void *ctx)
{
REQUEST *request = ctx;
home_server *home;
char buffer[128];
rad_assert(request->magic == REQUEST_MAGIC);
rad_assert(request->child_state == REQUEST_PROXIED);
/*
* If we've failed over to an internal home server,
* replace the callback with the correct one. This
* is due to locking issues with child threads...
*/
if (request->home_server->server) {
wait_a_bit(request);
return;
}
check_for_zombie_home_server(request);
home = request->home_server;
/*
* The default as of 2.1.7 is to allow requests to
* fail-over to a backup home server when this one does
* not respond. The old behavior can be configured as
* well.
*/
if (home->no_response_fail) {
radlog(L_ERR, "Rejecting request %u (proxy Id %d) due to lack of any response from home server %s port %d",
request->number, request->proxy->id,
inet_ntop(request->proxy->dst_ipaddr.af,
&request->proxy->dst_ipaddr.ipaddr,
buffer, sizeof(buffer)),
request->proxy->dst_port);
post_proxy_fail_handler(request);
} else {
rad_assert(request->ev == NULL);
request->child_state = REQUEST_RUNNING;
wait_a_bit(request);
}
/*
* Don't touch request due to race conditions
*/
/*
* If it's not alive, don't try to make it a zombie.
*/
if (home->state != HOME_STATE_ALIVE) {
/*
* Don't check home->ev due to race conditions.
*/
return;
}
/*
* We've received a real packet recently. Don't mark the
* server as zombie until we've received NO packets for a
* while. The "1/4" of zombie period was chosen rather
* arbitrarily. It's a balance between too short, which
* gives quick fail-over and fail-back, or too long,
* where the proxy still sends packets to an unresponsive
* home server.
*/
if ((home->last_packet + ((home->zombie_period + 3) / 4)) >= now.tv_sec) {
return;
}
/*
* Enable the zombie period when we notice that the home
* server hasn't responded for a while. We back-date the
* zombie period to when we last received a response from
* the home server.
*/
home->state = HOME_STATE_ZOMBIE;
home->zombie_period_start.tv_sec = home->last_packet;
home->zombie_period_start.tv_usec = USEC / 2;
fr_event_delete(el, &home->ev);
home->currently_outstanding = 0;
home->num_received_pings = 0;
radlog(L_PROXY, "Marking home server %s port %d as zombie (it looks like it is dead).",
inet_ntop(home->ipaddr.af, &home->ipaddr.ipaddr,
buffer, sizeof(buffer)),
home->port);
/*
* Start pinging the home server.
*/
ping_home_server(home);
} | true | true | false | false | false | 1 |
write_flags(Bit16u flags, bx_bool change_IOPL, bx_bool change_IF)
{
// Build a mask of the following bits:
// x,NT,IOPL,OF,DF,IF,TF,SF,ZF,x,AF,x,PF,x,CF
Bit32u changeMask = 0x0dd5;
#if BX_CPU_LEVEL >= 3
changeMask |= EFlagsNTMask; // NT is modified as requested.
if (change_IOPL)
changeMask |= EFlagsIOPLMask; // IOPL is modified as requested.
#endif
if (change_IF)
changeMask |= EFlagsIFMask;
writeEFlags(Bit32u(flags), changeMask);
} | false | false | false | false | false | 0 |
do_plot (header *hdx, header *hdy, int m)
{ int cx,rx,cy,ry,i,ix,iy;
double *x,*y,h;
getmatrix(hdx,&rx,&cx,&x); getmatrix(hdy,&ry,&cy,&y);
if (cx!=cy || (rx>1 && ry!=rx))
{ error=22; output("Plot columns must agree!\n");
return;
}
if (scaling)
{ minmax(x,(long)cx*rx,&x_min,&x_max,&ix,&iy);
minmax(y,(long)cy*ry,&y_min,&y_max,&ix,&iy);
}
if (x_max>DBL_MAX) x_max=DBL_MAX;
if (x_min<-DBL_MAX) x_min=-DBL_MAX;
if (y_max>DBL_MAX) y_max=DBL_MAX;
if (y_min<-DBL_MAX) y_min=-DBL_MAX;
if (x_min>=x_max) x_min=x_max+1;
if (y_min>=y_max) y_min=y_max+1;
if (keepsquare)
{ if (x_max-x_min>y_max-y_min)
{ h=(y_max+y_min)/2;
y_max=h+(x_max-x_min)/2;
y_min=h-(x_max-x_min)/2;
}
else
{ h=(x_max+x_min)/2;
x_max=h+(y_max-y_min)/2;
x_min=h-(y_max-y_min)/2;
}
}
graphic_mode();
if (!holding) { gclear(); }
if (!holding || newframe) frame();
for (i=0; i<ry; i++)
{ plot_vector(mat(x,cx,(i>=rx)?rx-1:i,0),mat(y,cy,i,0),cx,m);
if (test_key()==escape) break;
}
gflush();
} | false | false | false | false | false | 0 |
inputweightsstr2(AjPStr str, long a, long b, long *weightsum,
steptr weight, boolean *weights, const char *prog)
{
/* input the character weights, 0 or 1 */
Char ch = '\0';
long i;
*weightsum = 0;
for (i = a; i < b; i++) {
ch = ajStrGetCharPos(str, i-1);
weight[i] = 1;
if (ch == '0' || ch == '1')
weight[i] = ch - '0';
else {
ajErr("ERROR: Bad weight character: %c -- "
"weights in %s must be 0 or 1\n", ch, prog);
exxit(-1);
}
*weightsum += weight[i];
}
*weights = true;
} | false | false | false | false | false | 0 |
get_addr(unsigned char **here,int len)
{
if (!len) return NULL;
(*here) += len;
return *here-len;
} | false | false | false | false | false | 0 |
update_onlmtasks(Stasche *sinfo)
{
const int pc_num = sinfo->pc_num;
const int *ntasks = sinfo->ntasks;
int **sched = sinfo->sched;
Module_table *module = sinfo->module;
Array_table *ahead = module->array_head;
int i, j;
int prev_level;
for (i = 0; i < pc_num; i++) {
Array_def_use_table_semnode *data = NULL;
prev_level = -1;
for (j = ntasks[i] - 1; j >= 0; j--) {
Block *p = sinfo->block[sched[i][j]];
Array_def_use_table_semnode *mayuse, *maymod;
IntSet local_array = NULL;
int size;
if (flg_lad_ya_templ) {
if (p->cmp_localize != NULL
&& (prev_level == -1
|| p->cmp_localize->memory_level == prev_level)) {
prev_level = p->cmp_localize->memory_level;
local_array = p->cmp_localize->local_array;
mayuse = copy_array_def_use_table_semnode(get_array_mayuse(p));
maymod = copy_array_def_use_table_semnode(get_array_maymod(p));
mayuse = select_array_du_semnode(mayuse, local_array, NULL, NULL);
maymod = select_array_du_semnode(maymod, local_array, NULL, NULL);
} else if (block_has_bigger_level_lm(p, prev_level)) {
break;
} else {
if (p->cmp_localize != NULL) {
prev_level = p->cmp_localize->memory_level;
}
mayuse = copy_array_def_use_table_semnode(get_array_mayuse(p));
maymod = copy_array_def_use_table_semnode(get_array_maymod(p));
}
} else {
mayuse = get_array_mayuse(p);
maymod = get_array_maymod(p);
}
data = max_range_array_def_use_table_semnode(data,
mayuse);
data = max_range_array_def_use_table_semnode(data,
maymod);
if (flg_lad_ya_templ) {
free_all_array_def_use_table_semnode(mayuse);
free_all_array_def_use_table_semnode(maymod);
}
size = get_max_array_du_semnode_size(data, ahead);
if (size > (lm_size + dsm_size) / 4) {
break;
}
}
sinfo->onlmtasks[i] = j + 1;
free_all_array_def_use_table_semnode(data);
}
} | false | false | false | false | false | 0 |
png_read_finish_row(png_structrp png_ptr)
{
/* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
/* Start of interlace block */
static PNG_CONST png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
/* Offset to next interlace block */
static PNG_CONST png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
/* Start of interlace block in the y direction */
static PNG_CONST png_byte png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1};
/* Offset to next interlace block in the y direction */
static PNG_CONST png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
png_debug(1, "in png_read_finish_row");
png_ptr->row_number++;
if (png_ptr->row_number < png_ptr->num_rows)
return;
if (png_ptr->interlaced)
{
png_ptr->row_number = 0;
/* TO DO: don't do this if prev_row isn't needed (requires
* read-ahead of the next row's filter byte.
*/
memset(png_ptr->prev_row, 0, png_ptr->rowbytes + 1);
do
{
png_ptr->pass++;
if (png_ptr->pass >= 7)
break;
png_ptr->iwidth = (png_ptr->width +
png_pass_inc[png_ptr->pass] - 1 -
png_pass_start[png_ptr->pass]) /
png_pass_inc[png_ptr->pass];
if (!(png_ptr->transformations & PNG_INTERLACE))
{
png_ptr->num_rows = (png_ptr->height +
png_pass_yinc[png_ptr->pass] - 1 -
png_pass_ystart[png_ptr->pass]) /
png_pass_yinc[png_ptr->pass];
}
else /* if (png_ptr->transformations & PNG_INTERLACE) */
break; /* libpng deinterlacing sees every row */
} while (png_ptr->num_rows == 0 || png_ptr->iwidth == 0);
if (png_ptr->pass < 7)
return;
}
/* Here after at the end of the last row of the last pass. */
png_read_finish_IDAT(png_ptr);
} | false | false | false | false | false | 0 |
twl_rtc_interrupt(int irq, void *rtc)
{
unsigned long events;
int ret = IRQ_NONE;
int res;
u8 rd_reg;
res = twl_rtc_read_u8(&rd_reg, REG_RTC_STATUS_REG);
if (res)
goto out;
/*
* Figure out source of interrupt: ALARM or TIMER in RTC_STATUS_REG.
* only one (ALARM or RTC) interrupt source may be enabled
* at time, we also could check our results
* by reading RTS_INTERRUPTS_REGISTER[IT_TIMER,IT_ALARM]
*/
if (rd_reg & BIT_RTC_STATUS_REG_ALARM_M)
events = RTC_IRQF | RTC_AF;
else
events = RTC_IRQF | RTC_PF;
res = twl_rtc_write_u8(BIT_RTC_STATUS_REG_ALARM_M,
REG_RTC_STATUS_REG);
if (res)
goto out;
if (twl_class_is_4030()) {
/* Clear on Read enabled. RTC_IT bit of TWL4030_INT_PWR_ISR1
* needs 2 reads to clear the interrupt. One read is done in
* do_twl_pwrirq(). Doing the second read, to clear
* the bit.
*
* FIXME the reason PWR_ISR1 needs an extra read is that
* RTC_IF retriggered until we cleared REG_ALARM_M above.
* But re-reading like this is a bad hack; by doing so we
* risk wrongly clearing status for some other IRQ (losing
* the interrupt). Be smarter about handling RTC_UF ...
*/
res = twl_i2c_read_u8(TWL4030_MODULE_INT,
&rd_reg, TWL4030_INT_PWR_ISR1);
if (res)
goto out;
}
/* Notify RTC core on event */
rtc_update_irq(rtc, 1, events);
ret = IRQ_HANDLED;
out:
return ret;
} | false | false | false | false | false | 0 |
cypress_process_packet(struct psmouse *psmouse, bool zero_pkt)
{
int i;
struct input_dev *input = psmouse->dev;
struct cytp_data *cytp = psmouse->private;
struct cytp_report_data report_data;
struct cytp_contact *contact;
struct input_mt_pos pos[CYTP_MAX_MT_SLOTS];
int slots[CYTP_MAX_MT_SLOTS];
int n;
cypress_parse_packet(psmouse, cytp, &report_data);
n = report_data.contact_cnt;
if (n > CYTP_MAX_MT_SLOTS)
n = CYTP_MAX_MT_SLOTS;
for (i = 0; i < n; i++) {
contact = &report_data.contacts[i];
pos[i].x = contact->x;
pos[i].y = contact->y;
}
input_mt_assign_slots(input, slots, pos, n, 0);
for (i = 0; i < n; i++) {
contact = &report_data.contacts[i];
input_mt_slot(input, slots[i]);
input_mt_report_slot_state(input, MT_TOOL_FINGER, true);
input_report_abs(input, ABS_MT_POSITION_X, contact->x);
input_report_abs(input, ABS_MT_POSITION_Y, contact->y);
input_report_abs(input, ABS_MT_PRESSURE, contact->z);
}
input_mt_sync_frame(input);
input_mt_report_finger_count(input, report_data.contact_cnt);
input_report_key(input, BTN_LEFT, report_data.left);
input_report_key(input, BTN_RIGHT, report_data.right);
input_report_key(input, BTN_MIDDLE, report_data.middle);
input_sync(input);
} | false | false | false | false | false | 0 |
startLeader( const LeaderNIC & ) {
checkForParagraphReopening();
lastFlowObjectWasWhitespace = false;
mifDoc.outSpecialChar( MifDoc::sTab );
inLeader = true;
setCurLeaderStream( new MifTmpOutputByteStream() );
} | false | false | false | false | false | 0 |
gt_pch_nx_VEC_ipa_edge_args_t_gc (void *x_p)
{
struct VEC_ipa_edge_args_t_gc * const x = (struct VEC_ipa_edge_args_t_gc *)x_p;
if (gt_pch_note_object (x, x, gt_pch_p_22VEC_ipa_edge_args_t_gc, gt_ggc_e_22VEC_ipa_edge_args_t_gc))
{
{
size_t i0;
size_t l0 = (size_t)(((*x).base).num);
for (i0 = 0; i0 != l0; i0++) {
if ((*x).base.vec[i0].jump_functions != NULL) {
size_t i1;
for (i1 = 0; i1 != (size_t)(((*x).base.vec[i0]).argument_count); i1++) {
switch (((*x).base.vec[i0].jump_functions[i1]).type)
{
case IPA_JF_KNOWN_TYPE:
gt_pch_n_9tree_node ((*x).base.vec[i0].jump_functions[i1].value.base_binfo);
break;
case IPA_JF_CONST:
gt_pch_n_9tree_node ((*x).base.vec[i0].jump_functions[i1].value.constant);
break;
case IPA_JF_CONST_MEMBER_PTR:
gt_pch_n_9tree_node ((*x).base.vec[i0].jump_functions[i1].value.member_cst.pfn);
gt_pch_n_9tree_node ((*x).base.vec[i0].jump_functions[i1].value.member_cst.delta);
break;
case IPA_JF_PASS_THROUGH:
gt_pch_n_9tree_node ((*x).base.vec[i0].jump_functions[i1].value.pass_through.operand);
break;
case IPA_JF_ANCESTOR:
gt_pch_n_9tree_node ((*x).base.vec[i0].jump_functions[i1].value.ancestor.type);
break;
default:
break;
}
}
gt_pch_note_object ((*x).base.vec[i0].jump_functions, x, gt_pch_p_22VEC_ipa_edge_args_t_gc, gt_types_enum_last);
}
}
}
}
} | false | false | false | false | false | 0 |
keepalive()
{
for (size_t j = 0; j < ndeeper; ++j)
deeper[j]->keepalive();
} | false | false | false | false | false | 0 |
copy_to_index(Tree t, Indexterm *terms, int importance,
conststring secno, conststring doctitle)
{
conststring id, title;
string h;
Indexterm term;
int i, n;
id = get_attrib(t, "id");
#ifdef USE_DATA_ATTRIBUTE
if (! (title = get_attrib(t, "data-index")))
#endif
title = get_attrib(t, "title");
/* Get term either from title attribute or contents */
if (title) {
i = 0;
while (title[i]) {
n = strcspn(title + i, "|"); /* Find | or \0 */
new(term);
term->importance = importance;
term->secno = secno ? newstring(secno) : NULL;
term->doctitle = newstring(doctitle);
term->url = NULL;
strapp(&term->url, base, "#", id, NULL);
h = newnstring(title + i, n);
parse_subterms(term, h);
if (! tsearch(term, (void**)terms, termcmp))
errx(1, "Out of memory while parsing term %s\n", h);
i += n;
if (title[i]) i++; /* Skip '|' */
}
if (final) /* Remove used attribute */
#ifdef USE_DATA_ATTRIBUTE
if (!delete_attrib(t, "data-index"))
#endif
delete_attrib(t, "title");
} else { /* Recursively copy contents */
h = NULL;
copy_contents(t, &h);
if (h) { /* Non-empty contents */
new(term);
term->importance = importance;
term->secno = secno ? newstring(secno) : NULL;
term->doctitle = newstring(doctitle);
term->url = NULL;
strapp(&term->url, base, "#", id, NULL);
parse_subterms(term, h);
if (! tsearch(term, (void**)terms, termcmp))
errx(1, "Out of memory while parsing term %s", h);
}
}
} | false | false | true | true | false | 1 |
write_keyword(FILE *fp, gchar *keyword, gint id, struct GMS_keyword_pak *values)
{
gint i=0;
while (values[i].label)
{
if (values[i].id == id)
fprintf(fp, " %s%s", keyword, values[i].label);
i++;
}
} | false | false | false | false | false | 0 |
zend_check_private_int(zend_function *fbc, zend_class_entry *ce, char *function_name_strval, int function_name_strlen TSRMLS_DC) /* {{{ */
{
if (!ce) {
return 0;
}
/* We may call a private function if:
* 1. The class of our object is the same as the scope, and the private
* function (EX(fbc)) has the same scope.
* 2. One of our parent classes are the same as the scope, and it contains
* a private function with the same name that has the same scope.
*/
if (fbc->common.scope == ce && EG(scope) == ce) {
/* rule #1 checks out ok, allow the function call */
return fbc;
}
/* Check rule #2 */
ce = ce->parent;
while (ce) {
if (ce == EG(scope)) {
if (zend_hash_find(&ce->function_table, function_name_strval, function_name_strlen+1, (void **) &fbc)==SUCCESS
&& fbc->op_array.fn_flags & ZEND_ACC_PRIVATE
&& fbc->common.scope == EG(scope)) {
return fbc;
}
break;
}
ce = ce->parent;
}
return NULL;
} | false | false | false | false | false | 0 |
uea_set_bulk_timeout(struct uea_softc *sc, u32 dsrate)
{
int ret;
u16 timeout;
/* in bulk mode the modem have problem with high rate
* changing internal timing could improve things, but the
* value is mysterious.
* ADI930 don't support it (-EPIPE error).
*/
if (UEA_CHIP_VERSION(sc) == ADI930 ||
altsetting[sc->modem_index] > 0 ||
sc->stats.phy.dsrate == dsrate)
return;
/* Original timming (1Mbit/s) from ADI (used in windows driver) */
timeout = (dsrate <= 1024*1024) ? 0 : 1;
ret = uea_request(sc, UEA_SET_TIMEOUT, timeout, 0, NULL);
uea_info(INS_TO_USBDEV(sc), "setting new timeout %d%s\n",
timeout, ret < 0 ? " failed" : "");
} | false | false | false | false | false | 0 |
xmlSchemaCheckUnionTypeDefCircular(xmlSchemaParserCtxtPtr pctxt,
xmlSchemaTypePtr type)
{
if (! WXS_IS_UNION(type))
return(0);
return(xmlSchemaCheckUnionTypeDefCircularRecur(pctxt, type,
type->memberTypes));
} | false | false | false | false | false | 0 |
process_library (struct filename *l)
{
char *buffptr;
char *objsptr;
struct filename *f;
size_t bufflen;
int ret;
char buff[COB_MEDIUM_BUFF];
char name[COB_MEDIUM_BUFF];
char objs[COB_MEDIUM_BUFF] = "\0";
bufflen = 0;
for (f = l; f; f = f->next) {
bufflen += strlen (f->object) + 2;
}
if (bufflen >= COB_MEDIUM_BUFF) {
objsptr = cobc_malloc (bufflen);
} else {
objsptr = objs;
}
for (f = l; f; f = f->next) {
strcat (objsptr, f->object);
strcat (objsptr, " ");
}
if (output_name) {
strcpy (name, output_name);
#ifndef _MSC_VER
if (strchr (output_name, '.') == NULL) {
strcat (name, ".");
strcat (name, COB_MODULE_EXT);
}
#endif
} else {
file_basename (l->source, name);
#ifndef _MSC_VER
strcat (name, ".");
strcat (name, COB_MODULE_EXT);
#endif
}
bufflen = strlen (cob_cc) + strlen (gccpipe) + strlen (cob_ldflags)
+ strlen (COB_EXPORT_DYN) + strlen (COB_SHARED_OPT)
+ strlen (name) + strlen (objsptr) + strlen (cob_libs)
+ strlen (COB_PIC_FLAGS) + 16;
if (bufflen >= COB_MEDIUM_BUFF) {
buffptr = cobc_malloc (bufflen);
} else {
buffptr = buff;
}
#ifdef _MSC_VER
sprintf (buff, gflag_set ?
"%s /Od /MDd /LDd /Zi /FR /Fe%s %s %s %s" :
"%s /MD /LD /Fe%s %s %s %s",
cob_cc, name, cob_ldflags, objsptr, cob_libs);
ret = process (buff);
#if _MSC_VER >= 1400
/* Embedding manifest */
if (ret == 0) {
sprintf (buff, "mt /manifest %s.dll.manifest /outputresource:%s.dll;#2", name, name);
ret = process (buff);
}
#endif
#else /* _MSC_VER */
sprintf (buffptr, "%s %s %s %s %s %s -o %s %s %s",
cob_cc, gccpipe, COB_SHARED_OPT, cob_ldflags, COB_PIC_FLAGS,
COB_EXPORT_DYN, name, objsptr, cob_libs);
ret = process (buffptr);
#ifdef COB_STRIP_CMD
if (strip_output && ret == 0) {
sprintf (buff, "%s %s", COB_STRIP_CMD, name);
ret = process (buff);
}
#endif
#endif /* _MSC_VER */
return ret;
} | false | false | false | true | false | 1 |
fsp_session_set_location_finish (FspSession *self,
GAsyncResult *res,
GError **error)
{
gpointer result = NULL;
g_return_val_if_fail (FSP_IS_SESSION (self), FALSE);
g_return_val_if_fail (G_IS_ASYNC_RESULT (res), FALSE);
result = _finish_async_request (G_OBJECT (self), res,
fsp_session_set_location, error);
return result ? TRUE : FALSE;
} | false | false | false | false | false | 0 |
set(const QList<MUCItem>& items, MUCManager::Action action = MUCManager::Unknown) {
action_ = action;
iq_ = createIQ(doc(), "set", room_.full(), id());
QDomElement muc = doc()->createElement("query");
muc.setAttribute("xmlns", "http://jabber.org/protocol/muc#admin");
iq_.appendChild(muc);
foreach(MUCItem item, items) {
muc.appendChild(item.toXml(*doc()));
}
} | false | false | false | false | false | 0 |
dot(const GLEPoint3D& p, GLEPoint3D* r) const {
int idx = 0;
for (int row = 0; row < 3; row++) {
double result = 0.0;
for (int col = 0; col < 3; col++) {
result += m_C[idx++]*p.m_C[col];
}
r->m_C[row] = result;
}
} | false | false | false | false | false | 0 |
si470x_fops_read(struct file *file, char __user *buf,
size_t count, loff_t *ppos)
{
struct si470x_device *radio = video_drvdata(file);
int retval = 0;
unsigned int block_count = 0;
/* switch on rds reception */
if ((radio->registers[SYSCONFIG1] & SYSCONFIG1_RDS) == 0)
si470x_rds_on(radio);
/* block if no new data available */
while (radio->wr_index == radio->rd_index) {
if (file->f_flags & O_NONBLOCK) {
retval = -EWOULDBLOCK;
goto done;
}
if (wait_event_interruptible(radio->read_queue,
radio->wr_index != radio->rd_index) < 0) {
retval = -EINTR;
goto done;
}
}
/* calculate block count from byte count */
count /= 3;
/* copy RDS block out of internal buffer and to user buffer */
while (block_count < count) {
if (radio->rd_index == radio->wr_index)
break;
/* always transfer rds complete blocks */
if (copy_to_user(buf, &radio->buffer[radio->rd_index], 3))
/* retval = -EFAULT; */
break;
/* increment and wrap read pointer */
radio->rd_index += 3;
if (radio->rd_index >= radio->buf_size)
radio->rd_index = 0;
/* increment counters */
block_count++;
buf += 3;
retval += 3;
}
done:
return retval;
} | false | false | false | false | false | 0 |
gimple_stmt_nonzero_warnv_p (gimple stmt, bool *strict_overflow_p)
{
switch (gimple_code (stmt))
{
case GIMPLE_ASSIGN:
return gimple_assign_nonzero_warnv_p (stmt, strict_overflow_p);
case GIMPLE_CALL:
return gimple_alloca_call_p (stmt);
default:
gcc_unreachable ();
}
} | false | false | false | false | false | 0 |
evas_object_clip_dirty(Evas_Object *obj)
{
Eina_List *l;
Evas_Object *data;
if (obj->cur.cache.clip.dirty) return ;
obj->cur.cache.clip.dirty = 1;
EINA_LIST_FOREACH(obj->clip.clipees, l, data)
evas_object_clip_dirty(data);
} | false | false | false | false | false | 0 |
unpack_comm(int n, int first, double *buf)
{
int i,m,last;
double **v = atom->v;
double **omega = atom->omega;
m = 0;
last = first + n;
for (i = first; i < last; i++) {
v[i][0] = buf[m++];
v[i][1] = buf[m++];
v[i][2] = buf[m++];
omega[i][0] = buf[m++];
omega[i][1] = buf[m++];
omega[i][2] = buf[m++];
}
} | false | false | false | false | false | 0 |
append_radio_msg(struct sk_buff *skb, int id,
struct hwsim_new_radio_params *param)
{
int ret;
ret = nla_put_u32(skb, HWSIM_ATTR_RADIO_ID, id);
if (ret < 0)
return ret;
if (param->channels) {
ret = nla_put_u32(skb, HWSIM_ATTR_CHANNELS, param->channels);
if (ret < 0)
return ret;
}
if (param->reg_alpha2) {
ret = nla_put(skb, HWSIM_ATTR_REG_HINT_ALPHA2, 2,
param->reg_alpha2);
if (ret < 0)
return ret;
}
if (param->regd) {
int i;
for (i = 0; i < ARRAY_SIZE(hwsim_world_regdom_custom); i++) {
if (hwsim_world_regdom_custom[i] != param->regd)
continue;
ret = nla_put_u32(skb, HWSIM_ATTR_REG_CUSTOM_REG, i);
if (ret < 0)
return ret;
break;
}
}
if (param->reg_strict) {
ret = nla_put_flag(skb, HWSIM_ATTR_REG_STRICT_REG);
if (ret < 0)
return ret;
}
if (param->p2p_device) {
ret = nla_put_flag(skb, HWSIM_ATTR_SUPPORT_P2P_DEVICE);
if (ret < 0)
return ret;
}
if (param->use_chanctx) {
ret = nla_put_flag(skb, HWSIM_ATTR_USE_CHANCTX);
if (ret < 0)
return ret;
}
if (param->hwname) {
ret = nla_put(skb, HWSIM_ATTR_RADIO_NAME,
strlen(param->hwname), param->hwname);
if (ret < 0)
return ret;
}
return 0;
} | false | false | false | false | false | 0 |
createNagAction(const Nag& nag)
{
QAction* action = new QAction(NagSet::nagToMenuString(nag), this);
m_actions[action] = EditAction(EditAction::AddNag, nag);
return action;
} | false | false | false | false | false | 0 |
hash_element_dtor(void *user, void *element)
{
struct curl_hash *h = (struct curl_hash *) user;
struct curl_hash_element *e = (struct curl_hash_element *) element;
if (e->key)
free(e->key);
h->dtor(e->ptr);
free(e);
} | false | false | false | false | false | 0 |
stv0900_activate_s2_modcod(struct stv0900_internal *intp,
enum fe_stv0900_demod_num demod)
{
u32 matype,
mod_code,
fmod,
reg_index,
field_index;
dprintk("%s\n", __func__);
if (intp->chip_id <= 0x11) {
msleep(5);
mod_code = stv0900_read_reg(intp, PLHMODCOD);
matype = mod_code & 0x3;
mod_code = (mod_code & 0x7f) >> 2;
reg_index = MODCODLSTF - mod_code / 2;
field_index = mod_code % 2;
switch (matype) {
case 0:
default:
fmod = 14;
break;
case 1:
fmod = 13;
break;
case 2:
fmod = 11;
break;
case 3:
fmod = 7;
break;
}
if ((INRANGE(STV0900_QPSK_12, mod_code, STV0900_8PSK_910))
&& (matype <= 1)) {
if (field_index == 0)
stv0900_write_reg(intp, reg_index,
0xf0 | fmod);
else
stv0900_write_reg(intp, reg_index,
(fmod << 4) | 0xf);
}
} else if (intp->chip_id >= 0x12) {
for (reg_index = 0; reg_index < 7; reg_index++)
stv0900_write_reg(intp, MODCODLST0 + reg_index, 0xff);
stv0900_write_reg(intp, MODCODLSTE, 0xff);
stv0900_write_reg(intp, MODCODLSTF, 0xcf);
for (reg_index = 0; reg_index < 8; reg_index++)
stv0900_write_reg(intp, MODCODLST7 + reg_index, 0xcc);
}
} | false | false | false | false | false | 0 |
stfl_ipool_destroy(struct stfl_ipool *pool)
{
if (!pool)
return;
stfl_ipool_flush(pool);
free(pool->code);
if (pool->to_wc_desc != (iconv_t)(-1))
iconv_close(pool->to_wc_desc);
if (pool->from_wc_desc != (iconv_t)(-1))
iconv_close(pool->from_wc_desc);
free(pool);
} | false | false | false | false | false | 0 |
lv_mirror_count(const struct logical_volume *lv)
{
struct lv_segment *seg;
uint32_t s, mirrors;
if (!(lv->status & MIRRORED))
return 1;
seg = first_seg(lv);
/* FIXME: RAID10 only supports 2 copies right now */
if (!strcmp(seg->segtype->name, "raid10"))
return 2;
if (lv->status & PVMOVE)
return seg->area_count;
mirrors = 0;
for (s = 0; s < seg->area_count; s++) {
if (seg_type(seg, s) != AREA_LV)
continue;
if (is_temporary_mirror_layer(seg_lv(seg, s)))
mirrors += lv_mirror_count(seg_lv(seg, s));
else
mirrors++;
}
return mirrors ? mirrors : 1;
} | false | false | false | false | false | 0 |
ath9k_hw_init_config(struct ath_hw *ah)
{
struct ath_common *common = ath9k_hw_common(ah);
ah->config.dma_beacon_response_time = 1;
ah->config.sw_beacon_response_time = 6;
ah->config.cwm_ignore_extcca = false;
ah->config.analog_shiftreg = 1;
ah->config.rx_intr_mitigation = true;
if (AR_SREV_9300_20_OR_LATER(ah)) {
ah->config.rimt_last = 500;
ah->config.rimt_first = 2000;
} else {
ah->config.rimt_last = 250;
ah->config.rimt_first = 700;
}
if (AR_SREV_9462(ah) || AR_SREV_9565(ah))
ah->config.pll_pwrsave = 7;
/*
* We need this for PCI devices only (Cardbus, PCI, miniPCI)
* _and_ if on non-uniprocessor systems (Multiprocessor/HT).
* This means we use it for all AR5416 devices, and the few
* minor PCI AR9280 devices out there.
*
* Serialization is required because these devices do not handle
* well the case of two concurrent reads/writes due to the latency
* involved. During one read/write another read/write can be issued
* on another CPU while the previous read/write may still be working
* on our hardware, if we hit this case the hardware poops in a loop.
* We prevent this by serializing reads and writes.
*
* This issue is not present on PCI-Express devices or pre-AR5416
* devices (legacy, 802.11abg).
*/
if (num_possible_cpus() > 1)
ah->config.serialize_regmode = SER_REG_MODE_AUTO;
if (NR_CPUS > 1 && ah->config.serialize_regmode == SER_REG_MODE_AUTO) {
if (ah->hw_version.macVersion == AR_SREV_VERSION_5416_PCI ||
((AR_SREV_9160(ah) || AR_SREV_9280(ah) || AR_SREV_9287(ah)) &&
!ah->is_pciexpress)) {
ah->config.serialize_regmode = SER_REG_MODE_ON;
} else {
ah->config.serialize_regmode = SER_REG_MODE_OFF;
}
}
ath_dbg(common, RESET, "serialize_regmode is %d\n",
ah->config.serialize_regmode);
if (AR_SREV_9285(ah) || AR_SREV_9271(ah))
ah->config.max_txtrig_level = MAX_TX_FIFO_THRESHOLD >> 1;
else
ah->config.max_txtrig_level = MAX_TX_FIFO_THRESHOLD;
} | false | false | false | false | false | 0 |
DeallocateDefgenericBinaryData(
void *theEnv)
{
#if (BLOAD || BLOAD_ONLY || BLOAD_AND_BSAVE) && (! RUN_TIME)
unsigned long space;
space = DefgenericBinaryData(theEnv)->GenericCount * sizeof(struct defgeneric);
if (space != 0) genlongfree(theEnv,(void *) DefgenericBinaryData(theEnv)->DefgenericArray,space);
space = DefgenericBinaryData(theEnv)->MethodCount * sizeof(struct method);
if (space != 0) genlongfree(theEnv,(void *) DefgenericBinaryData(theEnv)->MethodArray,space);
space = DefgenericBinaryData(theEnv)->RestrictionCount * sizeof(struct restriction);
if (space != 0) genlongfree(theEnv,(void *) DefgenericBinaryData(theEnv)->RestrictionArray,space);
space = DefgenericBinaryData(theEnv)->TypeCount * sizeof(void *);
if (space != 0) genlongfree(theEnv,(void *) DefgenericBinaryData(theEnv)->TypeArray,space);
space = DefgenericBinaryData(theEnv)->ModuleCount * sizeof(struct defgenericModule);
if (space != 0) genlongfree(theEnv,(void *) DefgenericBinaryData(theEnv)->ModuleArray,space);
#endif
} | false | false | false | false | false | 0 |
ra_response_chunk_commit(struct ra_client *client) {
if(RC->flags & CF_DONE) {
return;
}
if(RC->entity.length) {
buffer_add_f(&RC->send, "%x\r\n", RC->entity.length);
buffer_add(&RC->send, RC->entity.data, RC->entity.length);
buffer_clear(&RC->entity);
buffer_add_s(&RC->send, "\r\n");
}
} | false | false | false | false | false | 0 |
edge_to_cases_cleanup (const void *key ATTRIBUTE_UNUSED, void **value,
void *data ATTRIBUTE_UNUSED)
{
tree t, next;
for (t = (tree) *value; t; t = next)
{
next = CASE_CHAIN (t);
CASE_CHAIN (t) = NULL;
}
*value = NULL;
return true;
} | 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.