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 |
|---|---|---|---|---|---|---|
MD5_Init (MD5_CTX * ctx)
{
ctx->handle = gnutls_malloc (sizeof (digest_hd_st));
if (!ctx->handle)
abort ();
_gnutls_hash_init (ctx->handle, GNUTLS_DIG_MD5);
} | false | false | false | false | false | 0 |
eet_data_stream_write(Eet_Data_Stream *ds,
const void *data,
int size)
{
char *p;
if ((ds->pos + size) > ds->size)
{
ds->data = realloc(ds->data, ds->size + size + 512);
if (!ds->data)
{
ds->pos = 0;
ds->size = 0;
return;
}
ds->size = ds->size + size + 512;
}
p = ds->data;
memcpy(p + ds->pos, data, size);
ds->pos += size;
} | false | false | false | false | false | 0 |
uncompress_term(char *s, int *ip)
{
char c = s[(*ip)++];
if (c <= 0)
return get_variable_term(-c);
else {
int arity = sn_to_arity(c);
Term t = get_rigid_term_dangerously(c, arity);
int i;
for (i = 0; i < ARITY(t); i++)
ARG(t,i) = uncompress_term(s, ip);
return t;
}
} | false | false | false | false | false | 0 |
getContextName(const DIScope *Context, std::string &N) {
if (auto *NS = dyn_cast<DINamespace>(Context)) {
if (!NS->getName().empty()) {
getContextName(NS->getScope(), N);
N = N + NS->getName().str() + "::";
}
} else if (auto *TY = dyn_cast<DIType>(Context)) {
if (!TY->getName().empty()) {
getContextName(TY->getScope().resolve(TypeIdentifierMap), N);
N = N + TY->getName().str() + "::";
}
}
} | false | false | false | false | false | 0 |
fiasco_image_delete (fiasco_image_t *image)
/*
* FIASCO image destructor.
* Free memory of FIASCO image struct.
*
* No return value.
*
* Side effects:
* structure 'image' is discarded.
*/
{
image_t *this = cast_image (image);
if (!this)
return;
try
{
free_image (this);
}
catch
{
return;
}
} | false | false | false | false | false | 0 |
process_timeout_value(char *t)
{
char *s = t;
char *ptr;
if (s == CN || *s == '\0') {
idle_ms = IDLE_MS;
idle_randomize = True;
return 0;
}
if (*s == '~') {
idle_randomize = True;
s++;
}
idle_n = strtoul(s, &ptr, 0);
if (idle_n <= 0)
goto bad_idle;
switch (*ptr) {
case 'H':
case 'h':
idle_multiplier = IDLE_HR;
break;
case 'M':
case 'm':
idle_multiplier = IDLE_MIN;
break;
case 'S':
case 's':
case '\0':
idle_multiplier = IDLE_SEC;
break;
default:
goto bad_idle;
}
idle_ms = idle_n * idle_multiplier * MSEC_PER_SEC;
return 0;
bad_idle:
popup_an_error("Invalid idle timeout value '%s'", t);
idle_ms = 0L;
idle_randomize = False;
return -1;
} | false | false | false | false | false | 0 |
replica_delete_by_name (const char *name)
{
Object *replica;
if (name == NULL)
{
slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name, "replica_delete_by_name: "
"NULL argument\n");
return -1;
}
if (s_hash == NULL || s_lock == NULL)
{
slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name, "replica_delete_by_name: "
"replica hash is not initialized\n");
return -1;
}
slapi_rwlock_wrlock (s_lock);
/* locate object */
replica = (Object*)PL_HashTableLookup(s_hash, name);
if (replica == NULL)
{
slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name, "replica_delete_by_name: "
"replica with name (%s) is not in the hash.\n", name);
slapi_rwlock_unlock (s_lock);
return -1;
}
/* remove from hash */
PL_HashTableRemove(s_hash, name);
/* release replica */
object_release (replica);
slapi_rwlock_unlock (s_lock);
return 0;
} | false | false | false | false | false | 0 |
static_list (GtkWidget *widget, void *data)
{
gamgi_window *window = GAMGI_CAST_WINDOW data;
GtkWidget *dialog = window->dialog0;
GtkWidget *label, *button;
gamgi_bool *sensitive;
sensitive = (gamgi_bool *) g_object_get_data (G_OBJECT (dialog), "sensitive_reference");
label = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "label_group");
button = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "button_list");
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)) == FALSE)
{
/**********************************
* modify a single group directly *
**********************************/
gtk_label_set_text (GTK_LABEL (label), "Group");
sensitive[STATIC_REFERENCE_CONTAINER] = TRUE;
sensitive[STATIC_REFERENCE_POLYTOPE] = TRUE;
static_absolute (dialog);
}
else
{
/**********************************************
* modify multiple groups previously selected *
**********************************************/
gtk_label_set_text (GTK_LABEL (label), "Name");
sensitive[STATIC_REFERENCE_CONTAINER] = FALSE;
sensitive[STATIC_REFERENCE_POLYTOPE] = FALSE;
static_reset (window);
static_relative (dialog);
}
} | false | false | false | false | false | 0 |
DateCalc_week_of_year(Z_int *week,
Z_int *year, Z_int month, Z_int day)
{
if (DateCalc_check_date(*year,month,day))
{
*week = DateCalc_Week_Number(*year,month,day);
if (*week == 0) *week = DateCalc_Weeks_in_Year(--(*year));
else if (*week > DateCalc_Weeks_in_Year(*year))
{
*week = 1;
(*year)++;
}
return(true);
}
return(false);
} | false | false | false | false | false | 0 |
pk11_setAttributes(PK11SlotInfo *slot, CK_OBJECT_HANDLE id,
CK_ATTRIBUTE *setTemplate, CK_ULONG setTemplCount)
{
CK_RV crv;
CK_SESSION_HANDLE rwsession;
rwsession = PK11_GetRWSession(slot);
if (rwsession == CK_INVALID_SESSION) {
PORT_SetError(SEC_ERROR_BAD_DATA);
return SECFailure;
}
crv = PK11_GETTAB(slot)->C_SetAttributeValue(rwsession, id,
setTemplate, setTemplCount);
PK11_RestoreROSession(slot, rwsession);
if (crv != CKR_OK) {
PORT_SetError(PK11_MapError(crv));
return SECFailure;
}
return SECSuccess;
} | false | false | false | false | false | 0 |
removeRows(int row, int count, const QModelIndex & parent)
{
Q_ASSERT_X(!m_UID.isNull(), "DosageModel::removeRows", "before using the dosagemodel, you must specify the UID of the related drug");
if (WarnDebuggingData)
qWarning() << "DosageModel::removeRows (row:" << row << ";count" << count << ")" << parent;
if (row < 0)
return false;
setEditStrategy(QSqlTableModel::OnRowChange);
bool toReturn = false;
if (QSqlTableModel::removeRows(row, count, parent)) {
int i;
for(i=0; i < count; ++i) {
if (m_DirtyRows.contains(row+i))
m_DirtyRows.remove(row+i);
}
toReturn = true;
}
setEditStrategy(QSqlTableModel::OnManualSubmit);
return toReturn;
} | false | false | false | false | false | 0 |
dgnc_tty_tiocmset(struct tty_struct *tty,
unsigned int set, unsigned int clear)
{
struct dgnc_board *bd;
struct channel_t *ch;
struct un_t *un;
int ret = -EIO;
unsigned long flags;
if (!tty || tty->magic != TTY_MAGIC)
return ret;
un = tty->driver_data;
if (!un || un->magic != DGNC_UNIT_MAGIC)
return ret;
ch = un->un_ch;
if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
return ret;
bd = ch->ch_bd;
if (!bd || bd->magic != DGNC_BOARD_MAGIC)
return ret;
spin_lock_irqsave(&ch->ch_lock, flags);
if (set & TIOCM_RTS)
ch->ch_mostat |= UART_MCR_RTS;
if (set & TIOCM_DTR)
ch->ch_mostat |= UART_MCR_DTR;
if (clear & TIOCM_RTS)
ch->ch_mostat &= ~(UART_MCR_RTS);
if (clear & TIOCM_DTR)
ch->ch_mostat &= ~(UART_MCR_DTR);
ch->ch_bd->bd_ops->assert_modem_signals(ch);
spin_unlock_irqrestore(&ch->ch_lock, flags);
return 0;
} | false | false | false | false | false | 0 |
IoSeq_rawClone(IoSeq *proto)
{
if (ISSYMBOL(proto))
{
return proto;
}
else
{
IoSeq *self = IoObject_rawClonePrimitive(proto);
IoObject_setDataPointer_(self, UArray_clone(DATA(proto)));
return self;
}
} | false | false | false | false | false | 0 |
ScanFolderToAdd(const CPath& folder, bool deletesource)
{
int count = 0;
CDirIterator finder(folder);
CPath file = finder.GetFirstFile(CDirIterator::File, wxT("*.part.met"));
while (file.IsOk()) {
ConvertToeMule(folder.JoinPaths(file), deletesource);
file = finder.GetNextFile();
count++;
}
/* Shareaza
file = finder.GetFirstFile(CDirIterator::File, wxT("*.sd"));
while (!file.IsEmpty()) {
ConvertToeMule(file, deletesource);
file = finder.GetNextFile();
count++;
}
*/
file = finder.GetFirstFile(CDirIterator::Dir, wxT("*.*"));
while (file.IsOk()) {
ScanFolderToAdd(folder.JoinPaths(file), deletesource);
file = finder.GetNextFile();
}
return count;
} | false | false | false | false | false | 0 |
create_var(char* name, ExpListNode* list) {
Var *var;
ALLOC(var, Var);
var->line = yylineno;
var->name = name;
var->idxs = list;
return var;
} | false | false | false | false | false | 0 |
CleanObjComObjCopy (
Obj obj )
{
UInt i; /* loop variable */
/* remove the forwarding pointer */
ADDR_OBJ(obj)[0] = ELM_PLIST( ADDR_OBJ(obj)[0], 1 );
CHANGED_BAG(obj);
/* now it is cleaned */
RetypeBag( obj, TNUM_OBJ(obj) - COPYING );
/* clean the subvalues */
for ( i = 1; i <= LEN_PREC(obj); i++ ) {
CLEAN_OBJ( GET_ELM_PREC(obj,i) );
}
} | false | false | false | false | false | 0 |
get_bg0_tile_info( int offset )
{
int tile_number = grchamp_videoram[offset];
SET_TILE_INFO(
1,
tile_number,
palette_bank,
0)
} | false | false | false | false | false | 0 |
hit_structure()
{
int x1, y1;
int i, ch;
// Check bolts/objects
for(i = 0; i < MAX_BOLTS; i++)
{
if(!boltst[i])
continue;
x1 = (boltx[i] & (WORLD_SIZEX - 1)) >> 4;
y1 = (bolty[i] & (WORLD_SIZEY - 1)) >> 4;
ch = screen.get_map(x1, y1);
if(!IS_SPACE(ch) && (ch & HIT_MASK))
{
sound.g_bolt_hit(x1<<12, y1<<12);
enemies.make(&boltexpl, boltx[i], bolty[i]);
boltst[i] = 0;
if(bolt_objects[i])
gengine->free_obj(bolt_objects[i]);
bolt_objects[i] = NULL;
}
}
// Check player/bases
x1 = (x & (WORLD_SIZEX - 1)) >> 4;
y1 = (y & (WORLD_SIZEY - 1)) >> 4;
ch = screen.get_map(x1, y1);
if(!IS_SPACE(ch) && (ch & HIT_MASK))
{
if(prefs->cmd_indicator)
sound.g_player_damage();
else
_myship::hit(1000);
}
return 0;
} | false | false | false | false | false | 0 |
hashLookup(
DdLevelQueue * queue,
void * key)
{
int posn;
DdQueueItem *item;
posn = lqHash(key,queue->shift);
item = queue->buckets[posn];
while (item != NULL) {
if (item->key == key) {
return(item);
}
item = item->cnext;
}
return(NULL);
} | false | false | false | false | false | 0 |
set_own_mod(ATTR *attr, char *path, uid_t owner, gid_t group, mode_t mode)
{
if (chown(path, owner, group) != 0 && attr->uid == 0
#ifdef AFS
&& errno != EPERM
#endif
) {
berrno be;
Jmsg2(attr->jcr, M_WARNING, 0, _("Cannot change owner and/or group of %s: ERR=%s\n"),
path, be.bstrerror());
}
if (chmod(path, mode) != 0 && attr->uid == 0) {
berrno be;
Jmsg2(attr->jcr, M_WARNING, 0, _("Cannot change permissions of %s: ERR=%s\n"),
path, be.bstrerror());
}
} | false | false | false | false | false | 0 |
PrintString(const Proto* tf, int n)
{
const char* s=tf->kstr[n]->str;
printf("%d\t; ",n);
putchar('"');
for (; *s; s++)
{
switch (*s)
{
case '"': printf("\\\""); break;
case '\a': printf("\\a"); break;
case '\b': printf("\\b"); break;
case '\f': printf("\\f"); break;
case '\n': printf("\\n"); break;
case '\r': printf("\\r"); break;
case '\t': printf("\\t"); break;
case '\v': printf("\\v"); break;
default: putchar(*s); break;
}
}
putchar('"');
} | false | false | false | false | false | 0 |
allocate(u32bit n)
{
const u32bit BITMAP_SIZE = Memory_Block::bitmap_size();
const u32bit BLOCK_SIZE = Memory_Block::block_size();
Mutex_Holder lock(mutex);
if(n <= BITMAP_SIZE * BLOCK_SIZE)
{
const u32bit block_no = round_up(n, BLOCK_SIZE) / BLOCK_SIZE;
byte* mem = allocate_blocks(block_no);
if(mem)
return mem;
get_more_core(PREF_SIZE);
mem = allocate_blocks(block_no);
if(mem)
return mem;
throw Memory_Exhaustion();
}
void* new_buf = alloc_block(n);
if(new_buf)
return new_buf;
throw Memory_Exhaustion();
} | false | false | false | false | false | 0 |
netsnmp_large_fd_set_resize(netsnmp_large_fd_set * fdset, int setsize)
{
int fd_set_bytes;
if (fdset->lfs_setsize == setsize)
return;
if (setsize > FD_SETSIZE) {
fd_set_bytes = NETSNMP_FD_SET_BYTES(setsize);
if (fdset->lfs_setsize > FD_SETSIZE)
fdset->lfs_setptr = (fd_set *)realloc(fdset->lfs_setptr, fd_set_bytes);
else {
fdset->lfs_setptr = (fd_set *)malloc(fd_set_bytes);
*fdset->lfs_setptr = fdset->lfs_set;
}
} else {
if (fdset->lfs_setsize > FD_SETSIZE) {
fdset->lfs_set = *fdset->lfs_setptr;
free(fdset->lfs_setptr);
}
fdset->lfs_setptr = &fdset->lfs_set;
}
#if ! (! defined(cygwin) && defined(HAVE_WINSOCK_H))
{
int i;
/*
* Unix: clear the file descriptors defined in the resized *fdset
* but that were not defined in the original *fdset.
*/
for (i = fdset->lfs_setsize; i < setsize; i++)
FD_CLR(i, fdset->lfs_setptr);
}
#endif
fdset->lfs_setsize = setsize;
} | false | false | false | false | false | 0 |
parse_filename(Track *track) {
ExtraTrackData *etr;
gchar *template;
gchar **templates, **tplp;
g_return_if_fail (track);
etr = track->userdata;
g_return_if_fail (etr);
template = prefs_get_string("parsetags_template");
if (!template)
return;
templates = g_strsplit(template, ";", 0);
tplp = templates;
while (*tplp) {
if (parse_filename_with_template(NULL, etr->pc_path_utf8, *tplp))
break;
++tplp;
}
if (*tplp)
parse_filename_with_template(track, etr->pc_path_utf8, *tplp);
g_strfreev(templates);
g_free(template);
} | false | false | false | false | false | 0 |
toDocBuffer(OutBuffer *buf, Scope *sc)
{
//printf("AliasDeclaration::toDocbuffer() %s\n", toChars());
if (ident)
{
if (isDeprecated())
buf->writestring("deprecated ");
emitProtection(buf, protection);
buf->printf("alias %s = ", toChars());
if (Dsymbol *s = aliassym) // ident alias
{
prettyPrintDsymbol(buf, s, parent);
}
else if (Type *type = getType()) // type alias
{
if (type->ty == Tclass || type->ty == Tstruct || type->ty == Tenum)
{
if (Dsymbol *s = type->toDsymbol(NULL)) // elaborate type
prettyPrintDsymbol(buf, s, parent);
else
buf->writestring(type->toChars());
}
else
{
// simple type
buf->writestring(type->toChars());
}
}
buf->writestring(";\n");
}
} | false | false | false | false | false | 0 |
HPDF_LoadTTFontFromFile (HPDF_Doc pdf,
const char *file_name,
HPDF_BOOL embedding)
{
HPDF_Stream font_data;
const char *ret;
HPDF_PTRACE ((" HPDF_LoadTTFontFromFile\n"));
if (!HPDF_HasDoc (pdf))
return NULL;
/* create file stream */
font_data = HPDF_FileReader_New (pdf->mmgr, file_name);
if (HPDF_Stream_Validate (font_data)) {
ret = LoadTTFontFromStream (pdf, font_data, embedding, file_name);
} else
ret = NULL;
if (!ret)
HPDF_CheckError (&pdf->error);
return ret;
} | false | false | false | false | false | 0 |
greaterThan(const VersionThing & myVersionThing, const VersionThing & yourVersionThing)
{
// yourVersionThing > myVersionThing
bool newOne = false;
if (yourVersionThing.majorVersion > myVersionThing.majorVersion) {
newOne = true;
}
else if (yourVersionThing.majorVersion == myVersionThing.majorVersion) {
if (yourVersionThing.minorVersion > myVersionThing.minorVersion) {
newOne = true;
}
else if (yourVersionThing.minorVersion == myVersionThing.minorVersion) {
if (yourVersionThing.minorSubVersion > myVersionThing.minorSubVersion) {
newOne = true;
}
else if (yourVersionThing.minorSubVersion == myVersionThing.minorSubVersion) {
newOne = modifierGreaterThan(myVersionThing.releaseModifier, yourVersionThing.releaseModifier);
}
}
}
return newOne;
} | false | false | false | false | false | 0 |
e_gadcon_layout_pack_request_set(Evas_Object *obj, int pos, int size)
{
E_Gadcon_Layout_Item *bi;
if (!obj) return;
bi = evas_object_data_get(obj, "e_gadcon_layout_data");
if (!bi) return;
bi->ask.res = bi->sd->w;
if (pos < 0) pos = 0;
if ((bi->ask.res - pos) < size) pos = bi->ask.res - size;
bi->ask.size = size;
bi->ask.pos = pos;
_e_gadcon_layout_smart_reconfigure(bi->sd);
} | false | false | false | false | false | 0 |
start(void)
{
if (isRunning_)
return;
isRunning_ = true;
start_clock_ = clock();
start_time_ = time(0);
} | false | false | false | false | false | 0 |
resumeGC() {
d_postponeGC = false;
while(d_deleted.size() > 0) {
VariableValue* v = d_deleted.back();
d_deleted.pop_back();
delete v;
d_mm->deleteData(v);
}
} | false | false | false | false | false | 0 |
insertReload(unsigned NewVReg,
SlotIndex Idx,
MachineBasicBlock::iterator MI) {
MachineBasicBlock &MBB = *MI->getParent();
MachineInstrSpan MIS(MI);
TII.loadRegFromStackSlot(MBB, MI, NewVReg, StackSlot,
MRI.getRegClass(NewVReg), &TRI);
LIS.InsertMachineInstrRangeInMaps(MIS.begin(), MI);
DEBUG(dumpMachineInstrRangeWithSlotIndex(MIS.begin(), MI, LIS, "reload",
NewVReg));
++NumReloads;
} | false | false | false | false | false | 0 |
sms_extract_concatenation(const struct sms *sms, guint16 *ref_num,
guint8 *max_msgs, guint8 *seq_num)
{
struct sms_udh_iter iter;
enum sms_iei iei;
guint8 concat_hdr[4];
guint16 uninitialized_var(rn);
guint8 uninitialized_var(max), uninitialized_var(seq);
gboolean concatenated = FALSE;
/* We must ignore the entire user_data header here:
* If the length of the User Data Header is such that there
* are too few or too many octets in the final Information
* Element then the whole User Data Header shall be ignored.
*/
if (!sms_udh_iter_init(sms, &iter))
return FALSE;
/* According to the specification, we have to use the last
* useable header:
* In the event that IEs determined as not repeatable are
* duplicated, the last occurrence of the IE shall be used.
* In the event that two or more IEs occur which have mutually
* exclusive meanings (e.g. an 8bit port address and a 16bit
* port address), then the last occurring IE shall be used.
*/
while ((iei = sms_udh_iter_get_ie_type(&iter)) !=
SMS_IEI_INVALID) {
switch (iei) {
case SMS_IEI_CONCATENATED_8BIT:
if (sms_udh_iter_get_ie_length(&iter) != 3)
break;
sms_udh_iter_get_ie_data(&iter, concat_hdr);
if (concat_hdr[1] == 0)
break;
if (concat_hdr[2] == 0 || concat_hdr[2] > concat_hdr[1])
break;
rn = concat_hdr[0];
max = concat_hdr[1];
seq = concat_hdr[2];
concatenated = TRUE;
break;
case SMS_IEI_CONCATENATED_16BIT:
if (sms_udh_iter_get_ie_length(&iter) != 4)
break;
sms_udh_iter_get_ie_data(&iter, concat_hdr);
if (concat_hdr[2] == 0)
break;
if (concat_hdr[3] == 0 ||
concat_hdr[3] > concat_hdr[2])
break;
rn = (concat_hdr[0] << 8) | concat_hdr[1];
max = concat_hdr[2];
seq = concat_hdr[3];
concatenated = TRUE;
break;
default:
break;
}
sms_udh_iter_next(&iter);
}
if (!concatenated)
return FALSE;
if (ref_num)
*ref_num = rn;
if (max_msgs)
*max_msgs = max;
if (seq_num)
*seq_num = seq;
return TRUE;
} | false | false | false | false | true | 1 |
pthread_mutex_init(pthread_mutex_t*mutex,const pthread_mutexattr_t*mutexattr) {
memset(mutex,0,sizeof(pthread_mutex_t));
if (mutexattr) {
mutex->kind=mutexattr->__mutexkind;
}
mutex->lock.__spinlock=PTHREAD_SPIN_UNLOCKED;
return 0;
} | false | false | false | false | false | 0 |
vartable_iter_from_varno(gint var, GGobiData *d, GtkTreeModel **model, GtkTreeIter *iter)
{
GtkTreeModel *loc_model;
GtkTreePath *path;
gboolean valid;
loc_model = vartable_tree_model_get(d);
if (!loc_model)
return(FALSE);
path = gtk_tree_path_new_from_indices(var, -1);
valid = gtk_tree_model_get_iter(loc_model, iter, path);
gtk_tree_path_free(path);
if (model)
*model = loc_model;
return(valid);
} | false | false | false | false | false | 0 |
_add_env2(struct job_descriptor *job_desc, char *key, char *val)
{
int len;
char *new_env;
if (!job_desc->environment || !key || !val)
return; /* Nothing we can do for interactive jobs */
len = strlen(key) + strlen(val) + 2;
new_env = xmalloc(len);
snprintf(new_env, len, "%s=%s", key, val);
_add_env(job_desc, new_env);
xfree(new_env);
} | false | false | false | false | false | 0 |
pstore_column_matches(struct pstore_column *self, char *ref)
{
if (ref)
return id_or_name_matches(self->column_id, self->name, ref);
return true;
} | false | false | false | false | false | 0 |
refs_independent_p (mem_ref_p ref1, mem_ref_p ref2)
{
if (ref1 == ref2
|| bitmap_bit_p (ref1->indep_ref, ref2->id))
return true;
if (bitmap_bit_p (ref1->dep_ref, ref2->id))
return false;
if (!MEM_ANALYZABLE (ref1)
|| !MEM_ANALYZABLE (ref2))
return false;
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "Querying dependency of refs %u and %u: ",
ref1->id, ref2->id);
if (mem_refs_may_alias_p (ref1->mem, ref2->mem,
&memory_accesses.ttae_cache))
{
bitmap_set_bit (ref1->dep_ref, ref2->id);
bitmap_set_bit (ref2->dep_ref, ref1->id);
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "dependent.\n");
return false;
}
else
{
bitmap_set_bit (ref1->indep_ref, ref2->id);
bitmap_set_bit (ref2->indep_ref, ref1->id);
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "independent.\n");
return true;
}
} | false | false | false | false | false | 0 |
close_func(LexState*ls){
lua_State*L=ls->L;
FuncState*fs=ls->fs;
Proto*f=fs->f;
removevars(ls,0);
luaK_ret(fs,0,0);
luaM_reallocvector(L,f->code,f->sizecode,fs->pc,Instruction);
f->sizecode=fs->pc;
luaM_reallocvector(L,f->lineinfo,f->sizelineinfo,fs->pc,int);
f->sizelineinfo=fs->pc;
luaM_reallocvector(L,f->k,f->sizek,fs->nk,TValue);
f->sizek=fs->nk;
luaM_reallocvector(L,f->p,f->sizep,fs->np,Proto*);
f->sizep=fs->np;
luaM_reallocvector(L,f->locvars,f->sizelocvars,fs->nlocvars,LocVar);
f->sizelocvars=fs->nlocvars;
luaM_reallocvector(L,f->upvalues,f->sizeupvalues,f->nups,TString*);
f->sizeupvalues=f->nups;
ls->fs=fs->prev;
if(fs)anchor_token(ls);
L->top-=2;
} | false | false | false | false | false | 0 |
i915_update_sprite_point_enable(struct gl_context *ctx)
{
struct intel_context *intel = intel_context(ctx);
/* _NEW_PROGRAM */
struct i915_fragment_program *p =
(struct i915_fragment_program *) ctx->FragmentProgram._Current;
const GLbitfield64 inputsRead = p->FragProg.Base.InputsRead;
struct i915_context *i915 = i915_context(ctx);
GLuint s4 = i915->state.Ctx[I915_CTXREG_LIS4] & ~S4_VFMT_MASK;
int i;
GLuint coord_replace_bits = 0x0;
GLuint tex_coord_unit_bits = 0x0;
for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) {
/* _NEW_POINT */
if (ctx->Point.CoordReplace[i] && ctx->Point.PointSprite)
coord_replace_bits |= (1 << i);
if (inputsRead & VARYING_BIT_TEX(i))
tex_coord_unit_bits |= (1 << i);
}
/*
* Here we can't enable the SPRITE_POINT_ENABLE bit when the mis-match
* of tex_coord_unit_bits and coord_replace_bits, or this will make all
* the other non-point-sprite coords(like varying inputs, as we now use
* tex coord to implement varying inputs) be replaced to value (0, 0)-(1, 1).
*
* Thus, do fallback when needed.
*/
FALLBACK(intel, I915_FALLBACK_COORD_REPLACE,
coord_replace_bits && coord_replace_bits != tex_coord_unit_bits);
s4 &= ~S4_SPRITE_POINT_ENABLE;
s4 |= (coord_replace_bits && coord_replace_bits == tex_coord_unit_bits) ?
S4_SPRITE_POINT_ENABLE : 0;
if (s4 != i915->state.Ctx[I915_CTXREG_LIS4]) {
i915->state.Ctx[I915_CTXREG_LIS4] = s4;
I915_STATECHANGE(i915, I915_UPLOAD_CTX);
}
} | false | false | false | false | false | 0 |
efx_ef10_sriov_assign_vf_vport(struct efx_nic *efx,
unsigned int vf_i)
{
struct efx_ef10_nic_data *nic_data = efx->nic_data;
struct ef10_vf *vf = nic_data->vf + vf_i;
int rc;
if (WARN_ON_ONCE(!nic_data->vf))
return -EOPNOTSUPP;
rc = efx_ef10_vport_alloc(efx, EVB_PORT_ID_ASSIGNED,
MC_CMD_VPORT_ALLOC_IN_VPORT_TYPE_NORMAL,
vf->vlan, &vf->vport_id);
if (rc)
return rc;
rc = efx_ef10_vport_add_mac(efx, vf->vport_id, vf->mac);
if (rc) {
eth_zero_addr(vf->mac);
return rc;
}
rc = efx_ef10_evb_port_assign(efx, vf->vport_id, vf_i);
if (rc)
return rc;
vf->vport_assigned = 1;
return 0;
} | false | false | false | false | false | 0 |
FreeRedoListHead(void) {
if (RedoList) {
UndoScoreElement *elem = RedoList->data;
RedoList = g_list_remove(RedoList, elem);
g_free(elem);
}
} | false | false | false | false | false | 0 |
irq_domain_add_simple(struct device_node *of_node,
unsigned int size,
unsigned int first_irq,
const struct irq_domain_ops *ops,
void *host_data)
{
struct irq_domain *domain;
domain = __irq_domain_add(of_node_to_fwnode(of_node), size, size, 0, ops, host_data);
if (!domain)
return NULL;
if (first_irq > 0) {
if (IS_ENABLED(CONFIG_SPARSE_IRQ)) {
/* attempt to allocated irq_descs */
int rc = irq_alloc_descs(first_irq, first_irq, size,
of_node_to_nid(of_node));
if (rc < 0)
pr_info("Cannot allocate irq_descs @ IRQ%d, assuming pre-allocated\n",
first_irq);
}
irq_domain_associate_many(domain, first_irq, 0, size);
}
return domain;
} | false | false | false | false | false | 0 |
gms_free(HMMWork *wrk)
{
free_gsset(wrk);
free_state2gs(wrk);
free(wrk->gsindex);
if (wrk->fallback_score != NULL) {
free(wrk->fallback_score[0]);
free(wrk->fallback_score);
free(wrk->gms_is_selected);
}
gms_gprune_free(wrk);
} | false | false | false | false | false | 0 |
get_sos (j_decompress_ptr cinfo)
/* Process a SOS marker */
{
IJG_INT32 length;
int i, ci, n, c, cc;
jpeg_component_info * compptr;
INPUT_VARS(cinfo);
if (! cinfo->marker->saw_SOF)
ERREXIT(cinfo, JERR_SOS_NO_SOF);
INPUT_2BYTES(cinfo, length, return FALSE);
INPUT_BYTE(cinfo, n, return FALSE); /* Number of components */
TRACEMS1(cinfo, 1, JTRC_SOS, n);
if (length != (n * 2 + 6) || n < 1 || n > MAX_COMPS_IN_SCAN)
ERREXIT(cinfo, JERR_BAD_LENGTH);
cinfo->comps_in_scan = n;
/* Collect the component-spec parameters */
for (i = 0; i < n; i++) {
INPUT_BYTE(cinfo, cc, return FALSE);
INPUT_BYTE(cinfo, c, return FALSE);
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
ci++, compptr++) {
if (cc == compptr->component_id)
goto id_found;
}
ERREXIT1(cinfo, JERR_BAD_COMPONENT_ID, cc);
id_found:
cinfo->cur_comp_info[i] = compptr;
compptr->dc_tbl_no = (c >> 4) & 15;
compptr->ac_tbl_no = (c ) & 15;
TRACEMS3(cinfo, 1, JTRC_SOS_COMPONENT, cc,
compptr->dc_tbl_no, compptr->ac_tbl_no);
}
/* Collect the additional scan parameters Ss, Se, Ah/Al. */
INPUT_BYTE(cinfo, c, return FALSE);
cinfo->Ss = c;
INPUT_BYTE(cinfo, c, return FALSE);
cinfo->Se = c;
INPUT_BYTE(cinfo, c, return FALSE);
cinfo->Ah = (c >> 4) & 15;
cinfo->Al = (c ) & 15;
TRACEMS4(cinfo, 1, JTRC_SOS_PARAMS, cinfo->Ss, cinfo->Se,
cinfo->Ah, cinfo->Al);
/* Prepare to scan data & restart markers */
cinfo->marker->next_restart_num = 0;
/* Count another SOS marker */
cinfo->input_scan_number++;
INPUT_SYNC(cinfo);
return TRUE;
} | false | false | false | false | false | 0 |
Hierarchical(char genemetric, char arraymetric, char method, char* jobname)
{ int ok;
FILE* outputfile;
const int n = strlen(jobname) + strlen(".ext") + 1;
char* const filename = malloc(n*sizeof(char));
if (!filename)
{ printf("ERROR: Failed to allocate memory for file name\n");
return;
}
if (genemetric)
{ sprintf(filename, "%s.gtr", jobname);
outputfile = fopen(filename, "wt");
if (!outputfile) printf ("Failed opening output file %s\n", filename);
else
{ ok = HierarchicalCluster(outputfile, genemetric, 0, method);
if (!ok)
{ printf("ERROR: Failed to allocate sufficient memory for clustering\n");
return;
}
fclose(outputfile);
}
}
if (arraymetric)
{ sprintf(filename, "%s.atr", jobname);
outputfile = fopen(filename, "wt");
if (!outputfile) printf ("Failed opening output file %s\n", filename);
else
{ ok = HierarchicalCluster(outputfile, arraymetric, 1, method);
if (!ok)
{ printf("ERROR: Failed to allocate sufficient memory for clustering\n");
return;
}
fclose(outputfile);
}
}
sprintf(filename, "%s.cdt", jobname);
outputfile = fopen(filename, "wt");
if (!outputfile) printf ("Failed opening output file %s\n", filename);
else
{ Save(outputfile, genemetric!='\0', arraymetric!='\0');
fclose(outputfile);
}
free(filename);
return;
} | false | false | false | false | true | 1 |
fill(Home home,
Float::Linear::Term*& tf,
FloatVal m, FloatVal& d) const {
switch (this->t) {
case NT_CONST:
Float::Limits::check(m*c,"MiniModel::LinFloatExpr");
d += m*c;
break;
case NT_VAR:
Float::Limits::check(m*a,"MiniModel::LinFloatExpr");
tf->a=m*a; tf->x=x_float; tf++;
break;
case NT_NONLIN:
tf->a=m; tf->x=sum.ne->post(home, NULL); tf++;
break;
case NT_SUM:
for (int i=n_float; i--; ) {
Float::Limits::check(m*sum.tf[i].a,"MiniModel::LinFloatExpr");
tf[i].x = sum.tf[i].x; tf[i].a = m*sum.tf[i].a;
}
tf += n_float;
break;
case NT_ADD:
if (l == NULL) {
Float::Limits::check(m*c,"MiniModel::LinFloatExpr");
d += m*c;
} else {
l->fill(home,tf,m,d);
}
r->fill(home,tf,m,d);
break;
case NT_SUB:
if (l == NULL) {
Float::Limits::check(m*c,"MiniModel::LinFloatExpr");
d += m*c;
} else {
l->fill(home,tf,m,d);
}
r->fill(home,tf,-m,d);
break;
case NT_MUL:
Float::Limits::check(m*a,"MiniModel::LinFloatExpr");
l->fill(home,tf,m*a,d);
break;
default:
GECODE_NEVER;
}
} | false | false | false | false | false | 0 |
acpi_penalize_sci_irq(int irq, int trigger, int polarity)
{
if (irq >= 0 && irq < ARRAY_SIZE(acpi_irq_penalty)) {
if (trigger != ACPI_MADT_TRIGGER_LEVEL ||
polarity != ACPI_MADT_POLARITY_ACTIVE_LOW)
acpi_irq_penalty[irq] += PIRQ_PENALTY_ISA_ALWAYS;
else
acpi_irq_penalty[irq] += PIRQ_PENALTY_PCI_USING;
}
} | false | false | false | false | false | 0 |
ntb_store_save_message(struct ntb_store *store,
int64_t timestamp,
struct ntb_key *from_key,
const char *from_address,
struct ntb_key *to_key,
struct ntb_blob *blob)
{
struct ntb_store_task *task;
if (store == NULL)
store = ntb_store_get_default_or_abort();
pthread_mutex_lock(&store->mutex);
task = new_task(store, NTB_STORE_TASK_TYPE_SAVE_MESSAGE);
task->save_message.timestamp = timestamp;
if (from_key)
task->save_message.from_key = ntb_key_ref(from_key);
else
task->save_message.from_key = NULL;
strcpy(task->save_message.from_address, from_address);
task->save_message.to_key = ntb_key_ref(to_key);
task->save_message.blob = ntb_blob_ref(blob);
pthread_mutex_unlock(&store->mutex);
} | false | false | false | false | false | 0 |
conversion_error_other (int errnum, const char* infilename)
{
fflush(stdout);
if (column > 0)
putc('\n',stderr);
error(0,errnum,
/* TRANSLATORS: The first part of an error message.
It is followed by a colon and a detail message.
The placeholders expand to the input file name, a line number, and a column number. */
_("%s:%u:%u"),
infilename,line,column);
} | false | false | false | false | false | 0 |
create_treenode(struct tt *tt, struct libmnt_table *tb,
struct libmnt_fs *fs, struct tt_line *parent_line)
{
struct libmnt_fs *chld = NULL;
struct libmnt_iter *itr = NULL;
struct tt_line *line;
int rc = -1;
if (!fs) {
/* first call, get root FS */
if (mnt_table_get_root_fs(tb, &fs))
goto leave;
parent_line = NULL;
} else if ((flags & FL_SUBMOUNTS) && has_line(tt, fs))
return 0;
itr = mnt_new_iter(MNT_ITER_FORWARD);
if (!itr)
goto leave;
line = add_line(tt, fs, parent_line);
if (!line)
goto leave;
/*
* add all children to the output table
*/
while(mnt_table_next_child_fs(tb, itr, fs, &chld) == 0) {
if (create_treenode(tt, tb, chld, line))
goto leave;
}
rc = 0;
leave:
mnt_free_iter(itr);
return rc;
} | false | false | false | false | false | 0 |
match_graph_event(int action_id, xmlNode * event, const char *event_node,
int op_status, int op_rc, int target_rc)
{
const char *target = NULL;
const char *allow_fail = NULL;
const char *this_event = NULL;
crm_action_t *action = NULL;
action = get_action(action_id, FALSE);
if (action == NULL) {
return -1;
}
op_status = status_from_rc(action, op_status, op_rc, target_rc);
if (op_status != PCMK_LRM_OP_DONE) {
update_failcount(event, event_node, op_rc, target_rc, FALSE);
}
/* Process OP status */
switch (op_status) {
case PCMK_LRM_OP_PENDING:
crm_debug("Ignoring pending operation");
return action->id;
break;
case PCMK_LRM_OP_DONE:
break;
case PCMK_LRM_OP_ERROR:
case PCMK_LRM_OP_TIMEOUT:
case PCMK_LRM_OP_NOTSUPPORTED:
action->failed = TRUE;
break;
case PCMK_LRM_OP_CANCELLED:
/* do nothing?? */
crm_err("Dont know what to do for cancelled ops yet");
break;
default:
action->failed = TRUE;
crm_err("Unsupported action result: %d", op_status);
}
/* stop this event's timer if it had one */
stop_te_timer(action->timer);
action->confirmed = TRUE;
update_graph(transition_graph, action);
trigger_graph();
if (action->failed) {
allow_fail = crm_meta_value(action->params, XML_ATTR_TE_ALLOWFAIL);
if (crm_is_true(allow_fail)) {
action->failed = FALSE;
}
}
if (action->failed) {
abort_transition(action->synapse->priority + 1, tg_restart, "Event failed", event);
}
this_event = crm_element_value(event, XML_LRM_ATTR_TASK_KEY);
target = crm_element_value(action->xml, XML_LRM_ATTR_TARGET);
crm_info("Action %s (%d) confirmed on %s (rc=%d)",
crm_str(this_event), action->id, crm_str(target), op_status);
return action->id;
} | false | false | false | false | false | 0 |
pt2258_stereo_volume_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_pt2258 *pt = kcontrol->private_data;
int base = kcontrol->private_value;
unsigned char bytes[2];
int val0, val1;
val0 = 79 - ucontrol->value.integer.value[0];
val1 = 79 - ucontrol->value.integer.value[1];
if (val0 < 0 || val0 > 79 || val1 < 0 || val1 > 79)
return -EINVAL;
if (val0 == pt->volume[base] && val1 == pt->volume[base + 1])
return 0;
pt->volume[base] = val0;
bytes[0] = pt2258_channel_code[2 * base] | (val0 / 10);
bytes[1] = pt2258_channel_code[2 * base + 1] | (val0 % 10);
snd_i2c_lock(pt->i2c_bus);
if (snd_i2c_sendbytes(pt->i2c_dev, bytes, 2) != 2)
goto __error;
snd_i2c_unlock(pt->i2c_bus);
pt->volume[base + 1] = val1;
bytes[0] = pt2258_channel_code[2 * base + 2] | (val1 / 10);
bytes[1] = pt2258_channel_code[2 * base + 3] | (val1 % 10);
snd_i2c_lock(pt->i2c_bus);
if (snd_i2c_sendbytes(pt->i2c_dev, bytes, 2) != 2)
goto __error;
snd_i2c_unlock(pt->i2c_bus);
return 1;
__error:
snd_i2c_unlock(pt->i2c_bus);
snd_printk(KERN_ERR "PT2258 access failed\n");
return -EIO;
} | true | true | false | false | false | 1 |
sa_filter_check_arguments(void *data, GtError *err)
{
GthSAFilter *sa_filter= (GthSAFilter*) data;
int had_err = 0;
gt_error_check(err);
gt_assert(sa_filter);
if (sa_filter->min_alignmentscore > sa_filter->max_alignmentscore) {
gt_error_set(err, "argument \"%.2f\" to option -%s must be smaller or "
"equal than argument \"%.2f\" to option -%s",
sa_filter->min_alignmentscore, MINALIGNMENTSCORE_OPT_CSTR,
sa_filter->max_alignmentscore, MAXALIGNMENTSCORE_OPT_CSTR);
had_err = -1;
}
if (!had_err && sa_filter->min_coverage > sa_filter->max_coverage) {
gt_error_set(err, "argument \"%.2f\" to option -%s must be smaller or "
"equal than argument \"%.2f\" to option -%s",
sa_filter->min_coverage, MINCOVERAGE_OPT_CSTR,
sa_filter->max_coverage, MAXCOVERAGE_OPT_CSTR);
had_err = -1;
}
return had_err;
} | false | false | false | false | false | 0 |
v_timer_advance(VUtilTimer *timer, double seconds)
{
if(timer == NULL)
return;
timer->seconds += (uint32) seconds;
timer->fractions += (uint32) ((seconds - (int) seconds) * (double) 0xffffffff);
} | false | false | false | false | false | 0 |
open_share_lock(SeqTable seq)
{
LocalTransactionId thislxid = MyProc->lxid;
/* Get the lock if not already held in this xact */
if (seq->lxid != thislxid)
{
ResourceOwner currentOwner;
currentOwner = CurrentResourceOwner;
PG_TRY();
{
CurrentResourceOwner = TopTransactionResourceOwner;
LockRelationOid(seq->relid, AccessShareLock);
}
PG_CATCH();
{
/* Ensure CurrentResourceOwner is restored on error */
CurrentResourceOwner = currentOwner;
PG_RE_THROW();
}
PG_END_TRY();
CurrentResourceOwner = currentOwner;
/* Flag that we have a lock in the current xact */
seq->lxid = thislxid;
}
/* We now know we have AccessShareLock, and can safely open the rel */
return relation_open(seq->relid, NoLock);
} | false | false | false | false | false | 0 |
advOpCleanupSpace()
{
tsh_put_it in ;
tsh_put_ot out ;
char wid[100], *var, *sid ;
space1_t *s, *t ;
/* send tuple name, priority, length */
if (!readn(newsock, (char *)&in, sizeof(tsh_put_it)))
{
return ;
}
in.proc_id = ntohl(in.proc_id);
if (guardf(in.host, in.proc_id))
{
return ;
}
out.error = htons((short int)TSH_ER_NOERROR) ;
out.status = htons((short int)SUCCESS) ;
writen(newsock, (char *)&out, sizeof(tsh_put_ot)) ;
sprintf(wid, "%s*", in.name) ;
s = tsh.space ;
var = (char *)malloc(100) ;
sid = (char *)malloc(TUPLENAME_LEN) ;
while (s)
{
sscanf(s->name, "%[^#]#%s", var, sid) ;
if (match(wid, sid))
{
t = s ;
s = t->next ;
if (t == tsh.space)
tsh.space = t->next ;
else
t->prev->next = t->next ;
if (t->next!= NULL)
t->next->prev = t->prev ;
free(t->tuple) ;
free(t) ;
}
else
{
s = s->next ;
}
}
free(var) ;
free(sid) ;
} | false | false | false | false | false | 0 |
isdn_audio_put_dle_code(modem_info *info, u_char code)
{
struct sk_buff *skb;
int di;
int ch;
char *p;
skb = dev_alloc_skb(2);
if (!skb) {
printk(KERN_WARNING
"isdn_audio: Could not alloc skb for ttyI%d\n",
info->line);
return;
}
p = (char *) skb_put(skb, 2);
p[0] = 0x10;
p[1] = code;
ISDN_AUDIO_SKB_DLECOUNT(skb) = 0;
ISDN_AUDIO_SKB_LOCK(skb) = 0;
di = info->isdn_driver;
ch = info->isdn_channel;
__skb_queue_tail(&dev->drv[di]->rpqueue[ch], skb);
dev->drv[di]->rcvcount[ch] += 2;
/* Schedule dequeuing */
if ((dev->modempoll) && (info->rcvsched))
isdn_timer_ctrl(ISDN_TIMER_MODEMREAD, 1);
wake_up_interruptible(&dev->drv[di]->rcv_waitq[ch]);
} | false | false | false | false | false | 0 |
EmitAssemblerFlag(MCAssemblerFlag Flag) {
switch (Flag) {
default: llvm_unreachable("not implemented");
case MCAF_SyntaxUnified:
case MCAF_Code16:
break;
}
} | false | false | false | false | false | 0 |
adjust_task_time ( offset )
int offset;
{
TaskData *td;
int st = get_selected_task ();
if ( st < 0 ) {
create_confirm_window ( CONFIRM_ERROR,
gettext("Error"),
gettext("You have not selected\na task to adjust the time for."),
gettext("Ok"), NULL, NULL,
NULL, NULL, NULL,
NULL );
} else {
update_tasks ();
td = visible_tasks[st];
if ( td->todays_entry == NULL )
td->todays_entry = taskNewTimeEntry ( td->task,
today_year, today_mon, today_mday );
if ( offset == 0 ) {
/* set to zero */
cutBuffer = td->todays_entry->seconds;
td->todays_entry->seconds = 0;
} else if ( offset < 0 ) {
/* decrement */
if ( td->todays_entry->seconds < ( 0 - offset ) ) {
cutBuffer += td->todays_entry->seconds;
td->todays_entry->seconds = 0;
} else {
cutBuffer += - offset;
td->todays_entry->seconds += offset;
}
} else {
td->todays_entry->seconds += offset;
}
modified_since_save = 1;
update_list ();
}
} | false | false | false | false | false | 0 |
fm10k_mbx_process_error(struct fm10k_hw *hw,
struct fm10k_mbx_info *mbx)
{
const u32 *hdr = &mbx->mbx_hdr;
u16 head;
/* we will need to pull all of the fields for verification */
head = FM10K_MSG_HDR_FIELD_GET(*hdr, HEAD);
switch (mbx->state) {
case FM10K_STATE_OPEN:
case FM10K_STATE_DISCONNECT:
/* flush any uncompleted work */
fm10k_mbx_reset_work(mbx);
/* reset CRC seeds */
mbx->local = FM10K_MBX_CRC_SEED;
mbx->remote = FM10K_MBX_CRC_SEED;
/* reset tail index and size to prepare for reconnect */
mbx->tail = head;
/* if open then reset max_size and go back to connect */
if (mbx->state == FM10K_STATE_OPEN) {
mbx->state = FM10K_STATE_CONNECT;
break;
}
/* send a connect message to get data flowing again */
fm10k_mbx_create_connect_hdr(mbx);
return 0;
default:
break;
}
return fm10k_mbx_create_reply(hw, mbx, mbx->tail);
} | false | false | false | false | false | 0 |
store_data_bypass_p (rtx out_insn, rtx in_insn)
{
rtx out_set, in_set;
in_set = single_set (in_insn);
if (! in_set)
abort ();
if (GET_CODE (SET_DEST (in_set)) != MEM)
return false;
out_set = single_set (out_insn);
if (out_set)
{
if (reg_mentioned_p (SET_DEST (out_set), SET_DEST (in_set)))
return false;
}
else
{
rtx out_pat;
int i;
out_pat = PATTERN (out_insn);
if (GET_CODE (out_pat) != PARALLEL)
abort ();
for (i = 0; i < XVECLEN (out_pat, 0); i++)
{
rtx exp = XVECEXP (out_pat, 0, i);
if (GET_CODE (exp) == CLOBBER)
continue;
if (GET_CODE (exp) != SET)
abort ();
if (reg_mentioned_p (SET_DEST (exp), SET_DEST (in_set)))
return false;
}
}
return true;
} | false | false | false | false | false | 0 |
get_official_ip(void)
{
gw_assert(official_ip != NULL);
return official_ip;
} | false | false | false | false | false | 0 |
hol_append (struct hol *hol, struct hol *more)
{
struct hol_cluster **cl_end = &hol->clusters;
/* Steal MORE's cluster list, and add it to the end of HOL's. */
while (*cl_end)
cl_end = &(*cl_end)->next;
*cl_end = more->clusters;
more->clusters = 0;
/* Merge entries. */
if (more->num_entries > 0)
{
if (hol->num_entries == 0)
{
hol->num_entries = more->num_entries;
hol->entries = more->entries;
hol->short_options = more->short_options;
more->num_entries = 0; /* Mark MORE's fields as invalid. */
}
else
/* Append the entries in MORE to those in HOL, taking care to only add
non-shadowed SHORT_OPTIONS values. */
{
unsigned left;
char *so, *more_so;
struct hol_entry *e;
unsigned num_entries = hol->num_entries + more->num_entries;
struct hol_entry *entries =
malloc (num_entries * sizeof (struct hol_entry));
unsigned hol_so_len = strlen (hol->short_options);
char *short_options =
malloc (hol_so_len + strlen (more->short_options) + 1);
__mempcpy (__mempcpy (entries, hol->entries,
hol->num_entries * sizeof (struct hol_entry)),
more->entries,
more->num_entries * sizeof (struct hol_entry));
__mempcpy (short_options, hol->short_options, hol_so_len);
/* Fix up the short options pointers from HOL. */
for (e = entries, left = hol->num_entries; left > 0; e++, left--)
e->short_options += (short_options - hol->short_options);
/* Now add the short options from MORE, fixing up its entries
too. */
so = short_options + hol_so_len;
more_so = more->short_options;
for (left = more->num_entries; left > 0; e++, left--)
{
int opts_left;
const struct argp_option *opt;
e->short_options = so;
for (opts_left = e->num, opt = e->opt; opts_left; opt++, opts_left--)
{
int ch = *more_so;
if (oshort (opt) && ch == opt->key)
/* The next short option in MORE_SO, CH, is from OPT. */
{
if (! find_char (ch, short_options,
short_options + hol_so_len))
/* The short option CH isn't shadowed by HOL's options,
so add it to the sum. */
*so++ = ch;
more_so++;
}
}
}
*so = '\0';
free (hol->entries);
free (hol->short_options);
hol->entries = entries;
hol->num_entries = num_entries;
hol->short_options = short_options;
}
}
hol_free (more);
} | false | false | false | false | false | 0 |
gdata_youtube_video_set_category (GDataYouTubeVideo *self, GDataMediaCategory *category)
{
g_return_if_fail (GDATA_IS_YOUTUBE_VIDEO (self));
g_return_if_fail (GDATA_IS_MEDIA_CATEGORY (category));
gdata_media_group_set_category (self->priv->media_group, category);
g_object_notify (G_OBJECT (self), "category");
} | false | false | false | false | false | 0 |
jbitmap_check(struct jbitmaps *bms)
{
if (bms->msize == ((Job_seg.dptr->js_maxjobs + 31) >> 5) << 2)
return 1;
jbitmap_free(bms);
return jbitmap_init(bms);
} | false | false | false | false | false | 0 |
writeToElement(QDomElement & ercElement, QDomDocument & doc) {
switch (m_eType) {
case Ground:
ercElement.setAttribute("etype", "ground");
writeCurrent(ercElement, doc);
break;
case VCC:
ercElement.setAttribute("etype", "VCC");
writeCurrent(ercElement, doc);
writeVoltage(ercElement, doc);
break;
default:
return false;
}
return true;
} | false | false | false | false | false | 0 |
knh_class_Generics(CTX ctx, kclass_t bcid, kParam *pa)
{
const knh_ClassTBL_t *t = ClassTBL(bcid);
while(t != NULL) {
if(t->cparam != NULL && knh_Param_equalsType(pa, t->cparam)) {
return t->cid;
}
t = t->simTBL;
}
if(bcid == CLASS_Immutable) {
kclass_t p1 = knh_Param_get(pa,0)->type;
if(p1 < ctx->share->sizeClassTBL && class_isImmutable(p1)) return p1;
}
return knh_addGenericsClass(ctx, CLASS_newid, bcid, pa);
} | false | false | false | false | false | 0 |
gvrender_end_graph(GVJ_t * job)
{
gvrender_engine_t *gvre = job->render.engine;
if (gvre) {
if (gvre->end_graph)
gvre->end_graph(job);
}
gvdevice_format(job);
} | false | false | false | false | false | 0 |
address_is_invalid_destination(const char *address, int client)
{
if (client) {
if (get_options()->AllowNonRFC953Hostnames)
return 0;
} else {
if (get_options()->ServerDNSAllowNonRFC953Hostnames)
return 0;
}
while (*address) {
if (TOR_ISALNUM(*address) ||
*address == '-' ||
*address == '.' ||
*address == '_') /* Underscore is not allowed, but Windows does it
* sometimes, just to thumb its nose at the IETF. */
++address;
else
return 1;
}
return 0;
} | false | false | false | false | false | 0 |
originalString() const
{
return element() ? element()->string() : 0;
} | false | false | false | false | false | 0 |
SendKillMessage(int id, int victim)
{
int suicide = 0;
if (id == 0) {id = victim; suicide = 1;}
byte sHealth[4];
byte sArmor[4]; //= player[id].health
int sHealthLength = sprintf((char*)sHealth, "%i", (int) player[id].health);
int sArmorLength = sprintf((char*)sArmor, "%i", (int) player[id].armor);
int sNameLength = u_strlen(player[id].name);
int length = 4 + sNameLength + sHealthLength + sArmorLength;
stream* buf = init_stream(NULL);
byte buffer[] = {19,victim,((suicide == 1) ? 0 : id),
player[id].actualweapon,
SHORT(*player[victim].x),SHORT(*player[victim].y),
240,0,1,SHORT(length),'k',166}; // 166 acts like a string separator, rest of this line is like wtf
Stream.write(buf, buffer, 15);
if (suicide == 0) {
Stream.write(buf, player[id].name, sNameLength);
Stream.write_byte(buf, 166);
Stream.write(buf, sHealth, sHealthLength);
Stream.write_byte(buf, 166);
Stream.write(buf, sArmor, sArmorLength);
Stream.write_byte(buf, 166);
}
SendToPlayer(buf->mem, buf->size, victim, 1);
free(buf->mem);
free(buf);
byte buffer2[] = {19,victim,id,player[id].actualweapon,SHORT(*player[victim].x),SHORT(*player[victim].y)};
SendToAllOther(victim, buffer2, 8, 1);
} | false | false | false | false | false | 0 |
search_table_chain_for_operator (TABLE_T * s, char * n, MOID_T * x, MOID_T * y)
{
if (is_mode_isnt_well (x)) {
return (error_tag);
} else if (y != NO_MOID && is_mode_isnt_well (y)) {
return (error_tag);
}
while (s != NO_TABLE) {
TAG_T *z = search_table_for_operator (OPERATORS (s), n, x, y);
if (z != NO_TAG) {
return (z);
}
BACKWARD (s);
}
return (NO_TAG);
} | false | false | false | false | false | 0 |
rfio_lasthost() /* returns last succesfully connected host */
{
char *last_host = NULL;
int last_host_len = 256;
Cglobals_get(&last_host_key, (void**)&last_host, last_host_len);
TRACE(4, "rfio", "connect: last_host_name: %s", last_host);
return(last_host);
} | false | false | false | false | false | 0 |
FnCallExecResult(struct FnCall *fp,struct Rlist *finalargs)
/* execresult("/programpath",useshell|noshell) */
{
struct Rval rval;
char buffer[CF_EXPANDSIZE];
int ret = false;
buffer[0] = '\0';
/* begin fn specific content */
if (!IsAbsoluteFileName(finalargs->item))
{
CfOut(cf_error,"","execresult \"%s\" does not have an absolute path\n",finalargs->item);
SetFnCallReturnStatus("execresult",FNCALL_FAILURE,strerror(errno),NULL);
strcpy(buffer,"!any");
}
if (!IsExecutable(GetArg0(finalargs->item)))
{
CfOut(cf_error,"","execresult \"%s\" is assumed to be executable but isn't\n",finalargs->item);
SetFnCallReturnStatus("execresult",FNCALL_FAILURE,strerror(errno),NULL);
strcpy(buffer,"!any");
}
else
{
if (strcmp(finalargs->next->item,"useshell") == 0)
{
ret = GetExecOutput(finalargs->item,buffer,true);
}
else
{
ret = GetExecOutput(finalargs->item,buffer,false);
}
if (ret)
{
SetFnCallReturnStatus("execresult",FNCALL_SUCCESS,NULL,NULL);
}
else
{
SetFnCallReturnStatus("execresult",FNCALL_FAILURE,strerror(errno),NULL);
}
}
if ((rval.item = strdup(buffer)) == NULL)
{
FatalError("Memory allocation in FnCallExecResult");
}
/* end fn specific content */
rval.rtype = CF_SCALAR;
return rval;
} | false | false | false | false | false | 0 |
dumpGraph (mcGraph* mcG, char* fname)
{
FILE* fp = fopen (fname, "w");
int id, id2, idx;
mcLevel *l;
mcLevel *nextl;
mcNode *n;
mcNode *nn;
mcEdge *e;
int dely = 72;
int delx = 100;
char* color;
char buf[512];
char buf2[512];
int width, maxl;
if (!fp) {
fprintf (stderr, "Could not open %s for writing\n", fname);
return;
}
fputs ("digraph {\n", fp);
fputs (" node[shape=box fontsize=8]\n", fp);
maxl = 0;
for (idx = 0; idx < mcG->lvl_cnt; idx++) {
l = mcG->lvls[idx];
if (l->nodecnt > maxl) maxl = l->nodecnt;
}
width = delx*(maxl+2);
for (idx = 0; idx < mcG->lvl_cnt; idx++) {
l = mcG->lvls[idx];
delx = width/(l->nodecnt + 1);
for (id = 0; id < l->nodecnt; id++) {
n = l->nodes[id];
sprintf(buf, "%s(%0.1f)", agnameof(n->node), n->order);
if (n->group)
color = "red";
else
color = "black";
fprintf (fp, " \"%s\" [pos=\"%d,%d\" color=%s]\n", buf, (id+1)*delx, -dely*idx, color);
}
}
for (idx = 0; idx < mcG->lvl_cnt-1; idx++) {
l = mcG->lvls[idx];
nextl = mcG->lvls[idx + 1];
for (id = 0; id < l->nodecnt; id++) {
n = l->nodes[id];
sprintf(buf, "%s(%0.1f)", agnameof(n->node), n->order);
for (id2 = 0; id2 < n->high_edgs_cnt; id2++) {
e = n->high_edgs[id2];
nn = e->higherN;
sprintf(buf2, "%s(%0.1f)", agnameof(nn->node), nn->order);
if (e->penalty > 1)
color = "red";
else
color = "black";
fprintf (fp, " \"%s\" -> \"%s\" [color=%s]\n", buf, buf2, color);
}
}
}
fputs ("}\n", fp);
fclose (fp);
} | true | true | false | false | true | 1 |
escape_text(const char *prepend, const char *str, unsigned escapee)
{
unsigned retlen, remainlen, chunklen;
char *ret, *found;
char append;
append = (char)escapee;
escapee >>= 8;
remainlen = strlen(str);
retlen = strlen(prepend);
ret = xmalloc(retlen + remainlen * 2 + 1 + 1);
strcpy(ret, prepend);
for (;;) {
found = strchrnul(str, escapee);
chunklen = found - str + 1;
/* Copy chunk up to and including escapee (or NUL) to ret */
memcpy(ret + retlen, str, chunklen);
retlen += chunklen;
if (*found == '\0') {
/* It wasn't escapee, it was NUL! */
ret[retlen - 1] = append; /* replace NUL */
ret[retlen] = '\0'; /* add NUL */
break;
}
ret[retlen++] = escapee; /* duplicate escapee */
str = found + 1;
}
return ret;
} | false | false | false | false | false | 0 |
io_hci_data(void)
{
unsigned char buf[HCI_MAX_FRAME_SIZE], *ptr;
int type;
ssize_t len;
ptr = buf;
len = read(vdev.dev_fd, buf, sizeof(buf));
if (len < 0) {
if (errno == EAGAIN)
return;
syslog(LOG_ERR, "Read failed: %s (%d)", strerror(errno), errno);
__io_canceled = 1;
return;
}
type = *ptr++;
write_snoop(vdev.dd, type, 0, buf, len);
switch (type) {
case HCI_COMMAND_PKT:
hci_command(ptr);
break;
case HCI_ACLDATA_PKT:
hci_acl_data(ptr);
break;
default:
syslog(LOG_ERR, "Unknown packet type 0x%2.2x", type);
break;
}
} | false | false | false | false | false | 0 |
push(int a){
stackElement.push_back(a);
if(stackMin.empty() || stackMin.back()>=a)
stackMin.push_back(a);
} | false | false | false | false | false | 0 |
gst_audio_encoder_set_hard_resync (GstAudioEncoder * enc, gboolean enabled)
{
g_return_if_fail (GST_IS_AUDIO_ENCODER (enc));
GST_LOG_OBJECT (enc, "enabled: %d", enabled);
GST_OBJECT_LOCK (enc);
enc->priv->hard_resync = enabled;
GST_OBJECT_UNLOCK (enc);
} | false | false | false | false | false | 0 |
startHumanMove (int x, int y)
{
int index = x * m_side + y;
bool humanPlayer = (! isComputer (m_currentPlayer));
qDebug() << "CLICK" << x << y << "index" << index;
if (! humanPlayer) {
buttonClick();
}
else if (humanPlayer && ((m_currentPlayer == m_box->owner(index)) ||
(m_box->owner(index) == Nobody))) {
m_waitingToMove = false;
m_moveNo++;
m_endMoveNo = LARGE_NUMBER;
qDebug() << "doMove (" << index;
KCubeWidget::enableClicks (false);
doMove (index);
}
} | false | false | false | false | false | 0 |
ethif_probe2(int unit)
{
unsigned long base_addr = netdev_boot_base("eth", unit);
if (base_addr == 1)
return;
(void)( probe_list2(unit, m68k_probes, base_addr == 0) &&
probe_list2(unit, isa_probes, base_addr == 0));
} | false | false | false | false | false | 0 |
remove_conditions_and_labels (loop_p loop)
{
gimple_stmt_iterator gsi;
unsigned int i;
for (i = 0; i < loop->num_nodes; i++)
{
basic_block bb = ifc_bbs[i];
if (bb_with_exit_edge_p (loop, bb)
|| bb == loop->latch)
continue;
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); )
switch (gimple_code (gsi_stmt (gsi)))
{
case GIMPLE_COND:
case GIMPLE_LABEL:
gsi_remove (&gsi, true);
break;
case GIMPLE_DEBUG:
/* ??? Should there be conditional GIMPLE_DEBUG_BINDs? */
if (gimple_debug_bind_p (gsi_stmt (gsi)))
{
gimple_debug_bind_reset_value (gsi_stmt (gsi));
update_stmt (gsi_stmt (gsi));
}
gsi_next (&gsi);
break;
default:
gsi_next (&gsi);
}
}
} | false | false | false | false | false | 0 |
N106_Power(void)
{
int x;
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x8000,0xffff,Mapper19_write);
SetWriteHandler(0x4020,0x5fff,Mapper19_write);
if(!is210)
{
SetWriteHandler(0xc000,0xdfff,Mapper19C0D8_write);
SetReadHandler(0x4800,0x4fff,Namco_Read4800);
SetReadHandler(0x5000,0x57ff,Namco_Read5000);
SetReadHandler(0x5800,0x5fff,Namco_Read5800);
NTAPage[0]=NTAPage[1]=NTAPage[2]=NTAPage[3]=0xFF;
FixNTAR();
}
SetReadHandler(0x6000,0x7FFF,AWRAM);
SetWriteHandler(0x6000,0x7FFF,BWRAM);
FCEU_CheatAddRAM(8,0x6000,WRAM);
gorfus=0xFF;
SyncPRG();
FixCRR();
if(!battery)
{
FCEU_dwmemset(WRAM,0,8192);
FCEU_dwmemset(IRAM,0,128);
}
for(x=0x40;x<0x80;x++)
FixCache(x,IRAM[x]);
} | false | false | false | false | false | 0 |
btmrvl_sdio_register_dev(struct btmrvl_sdio_card *card)
{
struct sdio_func *func;
u8 reg;
int ret = 0;
if (!card || !card->func) {
BT_ERR("Error: card or function is NULL!");
ret = -EINVAL;
goto failed;
}
func = card->func;
sdio_claim_host(func);
ret = sdio_enable_func(func);
if (ret) {
BT_ERR("sdio_enable_func() failed: ret=%d", ret);
ret = -EIO;
goto release_host;
}
ret = sdio_claim_irq(func, btmrvl_sdio_interrupt);
if (ret) {
BT_ERR("sdio_claim_irq failed: ret=%d", ret);
ret = -EIO;
goto disable_func;
}
ret = sdio_set_block_size(card->func, SDIO_BLOCK_SIZE);
if (ret) {
BT_ERR("cannot set SDIO block size");
ret = -EIO;
goto release_irq;
}
reg = sdio_readb(func, card->reg->io_port_0, &ret);
if (ret < 0) {
ret = -EIO;
goto release_irq;
}
card->ioport = reg;
reg = sdio_readb(func, card->reg->io_port_1, &ret);
if (ret < 0) {
ret = -EIO;
goto release_irq;
}
card->ioport |= (reg << 8);
reg = sdio_readb(func, card->reg->io_port_2, &ret);
if (ret < 0) {
ret = -EIO;
goto release_irq;
}
card->ioport |= (reg << 16);
BT_DBG("SDIO FUNC%d IO port: 0x%x", func->num, card->ioport);
if (card->reg->int_read_to_clear) {
reg = sdio_readb(func, card->reg->host_int_rsr, &ret);
if (ret < 0) {
ret = -EIO;
goto release_irq;
}
sdio_writeb(func, reg | 0x3f, card->reg->host_int_rsr, &ret);
if (ret < 0) {
ret = -EIO;
goto release_irq;
}
reg = sdio_readb(func, card->reg->card_misc_cfg, &ret);
if (ret < 0) {
ret = -EIO;
goto release_irq;
}
sdio_writeb(func, reg | 0x10, card->reg->card_misc_cfg, &ret);
if (ret < 0) {
ret = -EIO;
goto release_irq;
}
}
sdio_set_drvdata(func, card);
sdio_release_host(func);
return 0;
release_irq:
sdio_release_irq(func);
disable_func:
sdio_disable_func(func);
release_host:
sdio_release_host(func);
failed:
return ret;
} | false | false | false | false | false | 0 |
get_fg_tile_info(int tile_index)
{
int code = (gomoku_videoram[tile_index]);
int attr = (gomoku_colorram[tile_index]);
int color = (attr& 0x0f);
int flipyx = (attr & 0xc0) >> 6;
SET_TILE_INFO(
0,
code,
color,
TILE_FLIPYX(flipyx))
} | false | false | false | false | false | 0 |
anyUsePart(const QString & moduleID) {
foreach (QWidget *widget, QApplication::topLevelWidgets()) {
MainWindow *mainWindow = qobject_cast<MainWindow *>(widget);
if (mainWindow == NULL) continue;
if (mainWindow->usesPart(moduleID)) {
return true;
}
}
return false;
} | false | false | false | false | false | 0 |
stringio_read(stringio *self, PyObject *args)
{
Py_ssize_t size, n;
Py_UCS4 *output;
PyObject *arg = Py_None;
CHECK_INITIALIZED(self);
if (!PyArg_ParseTuple(args, "|O:read", &arg))
return NULL;
CHECK_CLOSED(self);
if (PyNumber_Check(arg)) {
size = PyNumber_AsSsize_t(arg, PyExc_OverflowError);
if (size == -1 && PyErr_Occurred())
return NULL;
}
else if (arg == Py_None) {
/* Read until EOF is reached, by default. */
size = -1;
}
else {
PyErr_Format(PyExc_TypeError, "integer argument expected, got '%s'",
Py_TYPE(arg)->tp_name);
return NULL;
}
/* adjust invalid sizes */
n = self->string_size - self->pos;
if (size < 0 || size > n) {
size = n;
if (size < 0)
size = 0;
}
/* Optimization for seek(0); read() */
if (self->state == STATE_ACCUMULATING && self->pos == 0 && size == n) {
PyObject *result = make_intermediate(self);
self->pos = self->string_size;
return result;
}
ENSURE_REALIZED(self);
output = self->buf + self->pos;
self->pos += size;
return PyUnicode_FromKindAndData(PyUnicode_4BYTE_KIND, output, size);
} | false | false | false | false | false | 0 |
fc_rpsc2_build(struct fchs_s *fchs, struct fc_rpsc2_cmd_s *rpsc2, u32 d_id,
u32 s_id, u32 *pid_list, u16 npids)
{
u32 dctlr_id = FC_DOMAIN_CTRLR(bfa_hton3b(d_id));
int i = 0;
fc_els_req_build(fchs, bfa_hton3b(dctlr_id), s_id, 0);
memset(rpsc2, 0, sizeof(struct fc_rpsc2_cmd_s));
rpsc2->els_cmd.els_code = FC_ELS_RPSC;
rpsc2->token = cpu_to_be32(FC_BRCD_TOKEN);
rpsc2->num_pids = cpu_to_be16(npids);
for (i = 0; i < npids; i++)
rpsc2->pid_list[i].pid = pid_list[i];
return sizeof(struct fc_rpsc2_cmd_s) + ((npids - 1) * (sizeof(u32)));
} | false | false | false | false | false | 0 |
mapToSource( const QModelIndexList& list ) const
{
QModelIndexList originalList;
foreach( const QModelIndex &index, list )
{
QModelIndex originalIndex = mapToSource( index );
if( originalIndex.isValid() )
originalList << originalIndex;
}
return originalList;
} | false | false | false | false | false | 0 |
slotOff(OPLL_SLOT * slot) {
if (slot->eg_mode == ATTACK)
slot->eg_phase = EXPAND_BITS(AR_ADJUST_TABLE[HIGHBITS(slot->eg_phase, EG_DP_BITS - EG_BITS)], EG_BITS, EG_DP_BITS);
slot->eg_mode = RELEASE;
} | false | false | false | false | false | 0 |
kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx,
struct kvm_io_device *dev)
{
int i;
struct kvm_io_bus *new_bus, *bus;
bus = kvm->buses[bus_idx];
if (!bus)
return;
for (i = 0; i < bus->dev_count; i++)
if (bus->range[i].dev == dev) {
break;
}
if (i == bus->dev_count)
return;
new_bus = kmalloc(sizeof(*bus) + ((bus->dev_count - 1) *
sizeof(struct kvm_io_range)), GFP_KERNEL);
if (!new_bus) {
pr_err("kvm: failed to shrink bus, removing it completely\n");
goto broken;
}
memcpy(new_bus, bus, sizeof(*bus) + i * sizeof(struct kvm_io_range));
new_bus->dev_count--;
memcpy(new_bus->range + i, bus->range + i + 1,
(new_bus->dev_count - i) * sizeof(struct kvm_io_range));
broken:
rcu_assign_pointer(kvm->buses[bus_idx], new_bus);
synchronize_srcu_expedited(&kvm->srcu);
kfree(bus);
return;
} | false | true | false | false | false | 1 |
Set(size_t idx)
{
if(idx >= nbits) return;
if( !_isfull() && !_isset(idx) ){
b[idx / 8] |= BIT_HEX[idx % 8];
nset++;
if( _isfull() && b){ delete []b; b = (unsigned char*) 0;}
}
} | false | false | false | false | false | 0 |
create_form_expr(Bounds *b, uint histid)
{
ht_expr_search_form *form = new ht_expr_search_form();
form->init(b, 0, (List*)getAtomValue(histid));
return form;
} | false | false | false | false | false | 0 |
scm_to_bool (SCM x)
{
if (scm_is_eq (x, SCM_BOOL_F))
return 0;
else if (scm_is_eq (x, SCM_BOOL_T))
return 1;
else
scm_wrong_type_arg (NULL, 0, x);
} | false | false | false | false | false | 0 |
init_cifs_idmap(void)
{
struct cred *cred;
struct key *keyring;
int ret;
cifs_dbg(FYI, "Registering the %s key type\n",
cifs_idmap_key_type.name);
/* create an override credential set with a special thread keyring in
* which requests are cached
*
* this is used to prevent malicious redirections from being installed
* with add_key().
*/
cred = prepare_kernel_cred(NULL);
if (!cred)
return -ENOMEM;
keyring = keyring_alloc(".cifs_idmap",
GLOBAL_ROOT_UID, GLOBAL_ROOT_GID, cred,
(KEY_POS_ALL & ~KEY_POS_SETATTR) |
KEY_USR_VIEW | KEY_USR_READ,
KEY_ALLOC_NOT_IN_QUOTA, NULL);
if (IS_ERR(keyring)) {
ret = PTR_ERR(keyring);
goto failed_put_cred;
}
ret = register_key_type(&cifs_idmap_key_type);
if (ret < 0)
goto failed_put_key;
/* instruct request_key() to use this special keyring as a cache for
* the results it looks up */
set_bit(KEY_FLAG_ROOT_CAN_CLEAR, &keyring->flags);
cred->thread_keyring = keyring;
cred->jit_keyring = KEY_REQKEY_DEFL_THREAD_KEYRING;
root_cred = cred;
cifs_dbg(FYI, "cifs idmap keyring: %d\n", key_serial(keyring));
return 0;
failed_put_key:
key_put(keyring);
failed_put_cred:
put_cred(cred);
return ret;
} | false | false | false | false | false | 0 |
produce_socket(struct mg_context *ctx, const struct socket *sp) {
(void) pthread_mutex_lock(&ctx->mutex);
// If the queue is full, wait
while (ctx->stop_flag == 0 &&
ctx->sq_head - ctx->sq_tail >= (int) ARRAY_SIZE(ctx->queue)) {
(void) pthread_cond_wait(&ctx->sq_empty, &ctx->mutex);
}
if (ctx->sq_head - ctx->sq_tail < (int) ARRAY_SIZE(ctx->queue)) {
// Copy socket to the queue and increment head
ctx->queue[ctx->sq_head % ARRAY_SIZE(ctx->queue)] = *sp;
ctx->sq_head++;
DEBUG_TRACE(("queued socket %d", sp->sock));
}
(void) pthread_cond_signal(&ctx->sq_full);
(void) pthread_mutex_unlock(&ctx->mutex);
} | false | false | false | false | false | 0 |
makedir(std::string &dirname) {
if(plug) {
plug->error_description="";
std::string dname=remove_head_dir_s(dirname,point.length());
return plug->makedir(dname);
};
return 1;
} | false | false | false | false | false | 0 |
sanei_genesys_set_buffer_address (Genesys_Device * dev, uint32_t addr)
{
SANE_Status status;
if(dev->model->asic_type==GENESYS_GL847
|| dev->model->asic_type==GENESYS_GL846
|| dev->model->asic_type==GENESYS_GL124)
{
DBG (DBG_warn,
"sanei_genesys_set_buffer_address: shouldn't be used for GL846+ ASICs\n");
return SANE_STATUS_GOOD;
}
DBG (DBG_io,
"sanei_genesys_set_buffer_address: setting address to 0x%05x\n",
addr & 0xfffffff0);
addr = addr >> 4;
status = sanei_genesys_write_register (dev, 0x2b, (addr & 0xff));
if (status != SANE_STATUS_GOOD)
{
DBG (DBG_error,
"sanei_genesys_set_buffer_address: failed while writing low byte: %s\n",
sane_strstatus (status));
return status;
}
addr = addr >> 8;
status = sanei_genesys_write_register (dev, 0x2a, (addr & 0xff));
if (status != SANE_STATUS_GOOD)
{
DBG (DBG_error,
"sanei_genesys_set_buffer_address: failed while writing high byte: %s\n",
sane_strstatus (status));
return status;
}
DBG (DBG_io, "sanei_genesys_set_buffer_address: completed\n");
return status;
} | false | false | false | false | false | 0 |
dup_bsock(BSOCK *osock)
{
BSOCK *bsock = (BSOCK *)malloc(sizeof(BSOCK));
memcpy(bsock, osock, sizeof(BSOCK));
bsock->msg = get_pool_memory(PM_BSOCK);
bsock->errmsg = get_pool_memory(PM_MESSAGE);
if (osock->who()) {
bsock->set_who(bstrdup(osock->who()));
}
if (osock->host()) {
bsock->set_host(bstrdup(osock->host()));
}
if (osock->src_addr) {
bsock->src_addr = New( IPADDR( *(osock->src_addr)) );
}
bsock->set_duped();
return bsock;
} | false | false | false | false | false | 0 |
IntrUnbComObjName (
UInt rnam )
{
Obj record; /* record, left operand */
/* ignore or code */
if ( IntrReturning > 0 ) { return; }
if ( IntrIgnoring > 0 ) { return; }
if ( IntrCoding > 0 ) { CodeUnbComObjName( rnam ); return; }
/* get the record (checking is done by 'UNB_REC') */
record = PopObj();
/* assign the right hand side to the element of the record */
if ( TNUM_OBJ(record) == T_COMOBJ ) {
UnbPRec( record, rnam );
}
else {
UNB_REC( record, rnam );
}
/* push void */
PushVoidObj();
} | 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.