本文整理汇总了C++中slist_add函数的典型用法代码示例。如果您正苦于以下问题:C++ slist_add函数的具体用法?C++ slist_add怎么用?C++ slist_add使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了slist_add函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pppoed_pppoe_session_close_notify
/* it called when the PPPoE session was closed */
void
pppoed_pppoe_session_close_notify(pppoed *_this, pppoe_session *session)
{
slist_add(&_this->session_free_list,
(void *)(intptr_t)session->session_id);
if (_this->acookie_hash != NULL)
hash_delete(_this->acookie_hash,
(void *)(intptr_t)session->acookie, 0);
if (_this->session_hash != NULL)
hash_delete(_this->session_hash,
(void *)(intptr_t)session->session_id, 0);
pppoe_session_fini(session);
free(session);
}
示例2: save_addr_port
int save_addr_port(struct netscan_result *result, unsigned int addr, unsigned short port)
{
struct addr_port *save = NULL;
save = (struct addr_port *)malloc(sizeof(struct addr_port));
if(!save)
return -1;
save->addr = addr;
save->port = port;
INIT_SLIST_NODE(&save->slist);
pthread_mutex_lock(&(result->list_lock));
slist_add(&result->addr_port_list, &save->slist);
++result->num;
pthread_mutex_unlock(&(result->list_lock));
return 0;
}
示例3: fake_classsym
Symbol *AggregateDeclaration::toInitializer()
{
if (!sinit)
{
Classsym *stag = fake_classsym(Id::ClassInfo);
Symbol *s = toSymbolX("__init", SCextern, stag->Stype, "Z");
s->Sfl = FLextern;
s->Sflags |= SFLnodebug;
StructDeclaration *sd = isStructDeclaration();
if (sd)
s->Salignment = sd->alignment;
slist_add(s);
sinit = s;
}
return sinit;
}
示例4: visit
void visit(ClassDeclaration *cd)
{
if (!cd->csym)
{
if (!scc)
scc = fake_classsym(Id::ClassInfo);
Symbol *s = cd->toSymbolX("__Class", SCextern, scc->Stype, "Z");
s->Sfl = FLextern;
s->Sflags |= SFLnodebug;
cd->csym = s;
slist_add(s);
}
result = cd->csym;
}
示例5: fake_classsym
Symbol *TypedefDeclaration::toInitializer()
{
Symbol *s;
Classsym *stag;
if (!sinit)
{
stag = fake_classsym(Id::ClassInfo);
s = toSymbolX("__init", SCextern, stag->Stype, "Z");
s->Sfl = FLextern;
s->Sflags |= SFLnodebug;
slist_add(s);
sinit = s;
}
return sinit;
}
示例6: visit
void visit(InterfaceDeclaration *id)
{
if (!id->csym)
{
if (!scc)
scc = fake_classsym(Id::ClassInfo);
Symbol *s = toSymbolX(id, "__Interface", SCextern, scc->Stype, "Z");
s->Sfl = FLextern;
s->Sflags |= SFLnodebug;
id->csym = s;
slist_add(s);
}
result = id->csym;
}
示例7: check_dependencies
/* all jobs must have successors except the end job, and all jobs must have predeccessors except the start job */
int check_dependencies(struct rcps_problem *p) {
int result = RCPS_CHECK_OK;
int end_count = 0;
int i, k;
struct rcps_job *start_job;
struct slist *visited;
struct slist *has_predecessor = slist_new(job_compare);
for (i = 0; i < p->job_count; ++i) {
struct rcps_job *j = p->jobs[ i ];
//printf("check_dependencies: job %s successors: %i\n", j->name, j->successor_count);
if (j->successor_count == 0) {
++end_count;
} else {
for (k = 0; k < j->successor_count; ++k) {
//printf("check_dependencies: job %s successor[%i] = %s\n", j->name, k, j->successors[k]->name);
slist_add(has_predecessor, slist_node_new(j->successors[k]));
}
}
}
if (end_count > 1) {
result += RCPS_CHECK_MULTIPLE_END_JOBS;
} else if (end_count == 0) {
result += RCPS_CHECK_END_JOB_MISSING;
}
if (result == RCPS_CHECK_OK) {
start_job = 0;
for (i = 0; i < p->job_count; ++i) {
if (!slist_find(has_predecessor, p->jobs[i])) {
start_job = p->jobs[i];
}
}
if (start_job) {
/* All other jobs should be successors of the start job */
//printf("check_dependencies: check circular\n");
visited = slist_new(job_compare);
result += check_circulardependencies(start_job, visited);
slist_free(visited, NULL);
} else {
result += RCPS_CHECK_START_JOB_MISSING;
}
}
slist_free(has_predecessor, NULL);
//printf("check_dependencies: result=%i\n", result);
return result;
}
示例8: fake_classsym
Symbol *toInitializer(EnumDeclaration *ed)
{
if (!ed->sinit)
{
Classsym *stag = fake_classsym(Id::ClassInfo);
Identifier *ident_save = ed->ident;
if (!ed->ident)
ed->ident = Identifier::generateId("__enum");
Symbol *s = toSymbolX(ed, "__init", SCextern, stag->Stype, "Z");
ed->ident = ident_save;
s->Sfl = FLextern;
s->Sflags |= SFLnodebug;
slist_add(s);
ed->sinit = s;
}
return ed->sinit;
}
示例9: fake_classsym
Symbol *ClassDeclaration::toSymbol()
{
if (!csym)
{
Symbol *s;
if (!scc)
scc = fake_classsym(Id::ClassInfo);
s = toSymbolX("__Class", SCextern, scc->Stype, "Z");
s->Sfl = FLextern;
s->Sflags |= SFLnodebug;
csym = s;
slist_add(s);
}
return csym;
}
示例10: toSymbol
Symbol *toVtblSymbol(ClassDeclaration *cd)
{
if (!cd->vtblsym)
{
if (!cd->csym)
toSymbol(cd);
TYPE *t = type_allocn(TYnptr | mTYconst, tsvoid);
t->Tmangle = mTYman_d;
Symbol *s = toSymbolX(cd, "__vtbl", SCextern, t, "Z");
s->Sflags |= SFLnodebug;
s->Sfl = FLextern;
cd->vtblsym = s;
slist_add(s);
}
return cd->vtblsym;
}
示例11: fake_classsym
Symbol *InterfaceDeclaration::toSymbol()
{
if (!csym)
{
Symbol *s;
if (!scc)
scc = fake_classsym("ClassInfo");
s = toSymbolX("_Interface_", SCextern, scc->Stype);
s->Sfl = FLextern;
s->Sflags |= SFLnodebug;
csym = s;
slist_add(s);
}
return csym;
}
示例12: symbol_calloc
type *TypeClass::toCtype()
{ type *t;
Symbol *s;
//printf("TypeClass::toCtype() %s\n", toChars());
if (ctype)
return ctype;
/* Need this symbol to do C++ name mangling
*/
const char *name = sym->isCPPinterface() ? sym->ident->toChars()
: sym->toPrettyChars();
s = symbol_calloc(name);
s->Sclass = SCstruct;
s->Sstruct = struct_calloc();
s->Sstruct->Sflags |= STRclass;
s->Sstruct->Salignsize = sym->alignsize;
s->Sstruct->Sstructalign = sym->structalign;
s->Sstruct->Sstructsize = sym->structsize;
t = type_alloc(TYstruct);
t->Ttag = (Classsym *)s; // structure tag name
t->Tcount++;
s->Stype = t;
slist_add(s);
t = type_allocn(TYnptr, t);
t->Tcount++;
ctype = t;
/* Add in fields of the class
* (after setting ctype to avoid infinite recursion)
*/
if (global.params.symdebug)
for (int i = 0; i < sym->fields.dim; i++)
{ VarDeclaration *v = sym->fields.tdata()[i];
Symbol *s2 = symbol_name(v->ident->toChars(), SCmember, v->type->toCtype());
s2->Smemoff = v->offset;
list_append(&s->Sstruct->Sfldlst, s2);
}
return t;
}
示例13: type_alloc
Symbol* ClassReferenceExp::toSymbol()
{
if (value->sym) return value->sym;
TYPE *t = type_alloc(TYint);
t->Tcount++;
Symbol *s = symbol_calloc("internal");
s->Sclass = SCstatic;
s->Sfl = FLextern;
s->Sflags |= SFLnodebug;
s->Stype = t;
value->sym = s;
dt_t *d = NULL;
toInstanceDt(&d);
s->Sdt = d;
slist_add(s);
outdata(s);
return value->sym;
}
示例14: freq_recv
int freq_recv(char *fn)
{
FILE *f;
char s[MAX_PATH],*p;
slist_t *reqs=NULL;
f=fopen(fn,"rt");
if(!f){write_log("can't open '%s' for reading: %s",fn,strerror(errno));return 0;}
while(fgets(s,MAX_PATH-1,f)) {
p=s+strlen(s)-1;
while(*p=='\r'||*p=='\n')*p--=0;
slist_add(&reqs,s);
}
fclose(f);
freq_ifextrp(reqs);
slist_kill(&reqs);
got_req=1;
return 1;
}
示例15: type_alloc
Symbol *static_sym()
{
Symbol *s;
type *t;
t = type_alloc(TYint);
t->Tcount++;
s = symbol_calloc("internal");
s->Sclass = SCstatic;
s->Sfl = FLextern;
s->Sflags |= SFLnodebug;
s->Stype = t;
#if ELFOBJ // Burton
s->Sseg = DATA;
#endif /* ELFOBJ */
slist_add(s);
return s;
}