本文整理汇总了C++中LL_APPEND函数的典型用法代码示例。如果您正苦于以下问题:C++ LL_APPEND函数的具体用法?C++ LL_APPEND怎么用?C++ LL_APPEND使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LL_APPEND函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: gnrc_pktbuf_add
static gnrc_pktsnip_t *_build_ipv6_packet(const ipv6_addr_t *src,
const ipv6_addr_t *dst, uint8_t nh,
void *data, size_t data_len,
uint16_t netif)
{
gnrc_pktsnip_t *netif_hdr, *ipv6, *payload;
ipv6_hdr_t *ipv6_hdr;
if ((netif > INT16_MAX) || (data_len > UINT16_MAX)) {
return NULL;
}
payload = gnrc_pktbuf_add(NULL, data, data_len, GNRC_NETTYPE_UNDEF);
if (payload == NULL) {
return NULL;
}
ipv6 = gnrc_ipv6_hdr_build(NULL, src, dst);
if (ipv6 == NULL) {
return NULL;
}
ipv6_hdr = ipv6->data;
ipv6_hdr->len = byteorder_htons((uint16_t)payload->size);
ipv6_hdr->nh = nh;
ipv6_hdr->hl = 64;
LL_APPEND(payload, ipv6);
netif_hdr = gnrc_netif_hdr_build(NULL, 0, NULL, 0);
if (netif_hdr == NULL) {
return NULL;
}
((gnrc_netif_hdr_t *)netif_hdr->data)->if_pid = (kernel_pid_t)netif;
LL_APPEND(payload, netif_hdr);
return payload;
}
开发者ID:LucaZulberti,项目名称:RIOT,代码行数:33,代码来源:stack.c
示例2: main
int main() {
int i;
el els[10], *e, *tmp, *tmp2;
for(i=0;i<10;i++) els[i].id='a'+i;
/* test LL macros */
printf("LL macros\n");
LL_APPEND(head,&els[0]);
LL_APPEND(head,&els[1]);
LL_APPEND(head,&els[2]);
LL_FOREACH(head,e)
printf("%c ", e->id);
printf("\n");
LL_SEARCH_SCALAR(head, e, id, 'b');
if (e) printf("search scalar found b\n");
LL_SEARCH(head, e, &els[0], eltcmp);
if (e) printf("search found %c\n",e->id);
LL_FOREACH_SAFE(head,e,tmp) LL_DELETE(head,e);
printf("\n");
/* test DL macros */
printf("DL macros\n");
DL_APPEND(head,&els[0]);
DL_APPEND(head,&els[1]);
DL_APPEND(head,&els[2]);
DL_FOREACH(head,e)
printf("%c ", e->id);
printf("\n");
DL_SEARCH_SCALAR(head, e, id, 'b');
if (e) printf("search scalar found b\n");
DL_SEARCH(head, e, &els[0], eltcmp);
if (e) printf("search found %c\n",e->id);
DL_FOREACH_SAFE(head,e,tmp) DL_DELETE(head,e);
printf("\n");
/* test CDL macros */
printf("CDL macros\n");
CDL_PREPEND(head,&els[0]);
CDL_PREPEND(head,&els[1]);
CDL_PREPEND(head,&els[2]);
CDL_FOREACH(head,e)
printf("%c ", e->id);
printf("\n");
CDL_SEARCH_SCALAR(head, e, id, 'b');
if (e) printf("search scalar found b\n");
CDL_SEARCH(head, e, &els[0], eltcmp);
if (e) printf("search found %c\n",e->id);
CDL_FOREACH_SAFE(head,e,tmp,tmp2) CDL_DELETE(head,e);
return 0;
}
开发者ID:bitfixer,项目名称:bitfixer,代码行数:53,代码来源:test42.c
示例3: db_change_parent
int
db_change_parent(Objid oid, Objid parent)
{
Objid old_parent;
if (!dbpriv_check_properties_for_chparent(oid, parent))
return 0;
if (objects[oid]->child == NOTHING && objects[oid]->verbdefs == NULL) {
/* Since this object has no children and no verbs, we know that it
can't have had any part in affecting verb lookup, since we use first
parent with verbs as a key in the verb lookup cache. */
/* The "no kids" rule is necessary because potentially one of the kids
could have verbs on it--and that kid could have cache entries for
THIS object's parentage. */
/* In any case, don't clear the cache. */
;
} else {
db_priv_affected_callable_verb_lookup();
}
old_parent = objects[oid]->parent;
if (old_parent != NOTHING)
LL_REMOVE(old_parent, child, oid, sibling);
if (parent != NOTHING)
LL_APPEND(parent, child, oid, sibling);
objects[oid]->parent = parent;
dbpriv_fix_properties_after_chparent(oid, old_parent);
return 1;
}
开发者ID:welterde,项目名称:NuMOO,代码行数:34,代码来源:db_objects.c
示例4: nitro_async_schedule
void nitro_async_schedule(nitro_async_t *a) {
pthread_mutex_lock(&the_runtime->l_async);
LL_APPEND(the_runtime->async_queue, a);
pthread_mutex_unlock(&the_runtime->l_async);
ev_async_send(the_runtime->the_loop,
&the_runtime->thread_wake);
}
开发者ID:bumptech,项目名称:nitro,代码行数:7,代码来源:async.c
示例5: gethttpmirrors
static void
gethttpmirrors(struct pkg_repo *repo, const char *url) {
FILE *f;
char *line = NULL;
size_t linecap = 0;
ssize_t linelen;
struct http_mirror *m;
struct url *u;
if ((f = fetchGetURL(url, "")) == NULL)
return;
while ((linelen = getline(&line, &linecap, f)) > 0) {
if (strncmp(line, "URL:", 4) == 0) {
/* trim '\n' */
if (line[linelen - 1] == '\n')
line[linelen - 1 ] = '\0';
line += 4;
while (isspace(*line)) {
line++;
}
if (*line == '\0')
continue;
if ((u = fetchParseURL(line)) != NULL) {
m = malloc(sizeof(struct http_mirror));
m->url = u;
LL_APPEND(repo->http, m);
}
}
}
fclose(f);
return;
}
开发者ID:O2Graphics,项目名称:pkg,代码行数:35,代码来源:fetch.c
示例6: gnrc_sixlowpan_frag_rbuf_dispatch_when_complete
void gnrc_sixlowpan_frag_rbuf_dispatch_when_complete(gnrc_sixlowpan_rbuf_t *rbuf,
gnrc_netif_hdr_t *netif_hdr)
{
assert(rbuf);
assert(netif_hdr);
if (rbuf->current_size == rbuf->pkt->size) {
gnrc_pktsnip_t *netif = gnrc_netif_hdr_build(rbuf->src,
rbuf->src_len,
rbuf->dst,
rbuf->dst_len);
if (netif == NULL) {
DEBUG("6lo rbuf: error allocating netif header\n");
gnrc_pktbuf_release(rbuf->pkt);
gnrc_sixlowpan_frag_rbuf_remove(rbuf);
return;
}
/* copy the transmit information of the latest fragment into the newly
* created header to have some link_layer information. The link_layer
* info of the previous fragments is discarded.
*/
gnrc_netif_hdr_t *new_netif_hdr = netif->data;
new_netif_hdr->if_pid = netif_hdr->if_pid;
new_netif_hdr->flags = netif_hdr->flags;
new_netif_hdr->lqi = netif_hdr->lqi;
new_netif_hdr->rssi = netif_hdr->rssi;
LL_APPEND(rbuf->pkt, netif);
gnrc_sixlowpan_dispatch_recv(rbuf->pkt, NULL, 0);
gnrc_sixlowpan_frag_rbuf_remove(rbuf);
}
}
开发者ID:kbumsik,项目名称:RIOT,代码行数:32,代码来源:gnrc_sixlowpan_frag.c
示例7: loadInterfaces
static Interface* loadInterfaces(Env* env, Class* clazz) {
ClassInfoHeader* header = lookupClassInfo(env, clazz->name,
!clazz->classLoader || !clazz->classLoader->parent ? _bcBootClassesHash : _bcClassesHash);
if (!header) return NULL;
ClassInfo ci;
jint i;
void* p = header;
readClassInfo(&p, &ci);
Interface* first = NULL;
for (i = 0; i < ci.interfaceCount; i++) {
const char* interfaceName = readInterfaceName(&p);
Class* interfaceClass = rvmFindClassUsingLoader(env, interfaceName, clazz->classLoader);
if (!interfaceClass) goto error;
Interface* interf = rvmAllocateInterface(env, interfaceClass);
if (!interf) goto error;
LL_APPEND(first, interf); // Interfaces has to be in the correct order so we need to use the slower LL_APPEND
}
return first;
error:
while (first) {
Interface* next = first->next;
rvmFreeMemoryUncollectable(env, first);
first = next;
}
return NULL;
}
开发者ID:SinoJerk,项目名称:robovm,代码行数:28,代码来源:bc.c
示例8: newControlledLed
ControlledLeds newControlledLed(Led led) {
struct LedGroup group = (struct LedGroup){ &led, 1 };
return newControlledLedGroup(&group);
}
ControlledLeds newControlledLedGroup(LedGroup group) {
if (group == NULL) return Invalid(ControlledLeds);
_ControlledLeds leds = kalloc(sizeof(struct _ControlledLeds));
if (!leds) return Invalid(ControlledLeds);
LedList *underlying = addNewLedsToList(group);
if (!underlying) {
free(leds);
return Invalid(ControlledLeds);
}
leds->mask = 0;
leds->leds = underlying;
leds->count = group->count;
leds->next = NULL;
ControlledLeds result = As(ControlledLeds, leds);
controlLeds(result, LedsDisabled);
LL_APPEND(controlled_leds, leds);
return result;
}
static void cleanUnderlyingLeds(ControlledLeds leds) {
LedList elem = NULL, tmp = NULL;
LL_FOREACH_SAFE(underlying_leds, elem, tmp) {
for (int i = 0; i < LEDS->count; i++) {
if (elem == LEDS->leds[i]) {
reduceRefcount(elem);
}
}
}
}
开发者ID:antongulenko,项目名称:TankOS,代码行数:34,代码来源:led_control.c
示例9: kalloc
static LedList *addNewLedsToList(LedGroup group) {
for (uint8_t i = 0; i < group->count; i++) {
if (!ledValid(group->leds[i]))
return NULL;
}
LedList *list = kalloc(group->count * sizeof(LedList));
if (!list) return NULL;
for (int i = 0; i < group->count; i++) {
Led led = group->leds[i];
LedList existing = NULL;
LL_FOREACH(underlying_leds, existing) {
if (Equal(existing->led, led)) break;
}
if (existing == NULL) {
existing = kalloc(sizeof(struct LedList));
if (!existing) {
// Cleanup all leds added so far...
for (int j = 0; j < i; j++) {
reduceRefcount(list[j]);
}
free(list);
return NULL;
}
existing->led = led;
existing->next = NULL;
existing->enabled = FALSE;
existing->references = 0;
LL_APPEND(underlying_leds, existing);
}
existing->references++;
list[i] = existing;
}
return list;
}
开发者ID:antongulenko,项目名称:TankOS,代码行数:34,代码来源:led_control.c
示例10: AddServerResponse
/**
* Add a server response to the server response list
*
* @param response initialized server response that is created by this function
* @param requestHandle - handle of the response
*
* @return
* OCStackResult
*/
static OCStackResult AddServerResponse (OCServerResponse ** response, OCRequestHandle requestHandle)
{
if (!response)
{
return OC_STACK_INVALID_PARAM;
}
OCServerResponse * serverResponse = NULL;
serverResponse = (OCServerResponse *) OICCalloc(1, sizeof(OCServerResponse));
VERIFY_NON_NULL(serverResponse);
serverResponse->payload = NULL;
serverResponse->requestHandle = requestHandle;
*response = serverResponse;
OIC_LOG(INFO, TAG, "Server Response Added!!");
LL_APPEND (serverResponseList, serverResponse);
return OC_STACK_OK;
exit:
if (serverResponse)
{
OICFree(serverResponse);
serverResponse = NULL;
}
*response = NULL;
return OC_STACK_NO_MEMORY;
}
开发者ID:Frank-KunLi,项目名称:iotivity,代码行数:39,代码来源:ocserverrequest.c
示例11: pthread_scheduler_push_kernel
void pthread_scheduler_push_kernel (kernel_run_command *run_cmd)
{
PTHREAD_LOCK (&scheduler.wq_lock, NULL);
LL_APPEND (scheduler.kernel_queue, run_cmd);
pthread_cond_broadcast (&scheduler.wake_pool);
PTHREAD_UNLOCK (&scheduler.wq_lock);
}
开发者ID:dsandersimgtec,项目名称:pocl,代码行数:7,代码来源:pthread_scheduler.c
示例12: AddPlugin
OCStackResult AddPlugin (PIPluginBase * plugin)
{
if (!plugin)
{
return OC_STACK_INVALID_PARAM;
}
LL_APPEND(pluginList, plugin);
return OC_STACK_OK;
}
开发者ID:Lyoncore,项目名称:iotivity-demo-uc15,代码行数:10,代码来源:pluginlist.c
示例13: rpcfg_string
static int
rpcfg_string(void *data, const unsigned char *s, size_t len)
{
struct rp_json_ctx *ctx = (struct rp_json_ctx *)data;
switch (ctx->state) {
case ROOT_CONFIG_IDENTITY_NICKS_ITEMS:
{
rp_str_list_t *l = rp_palloc(ctx->pool, sizeof(*l));
rpcfg_mkstr(ctx->pool, &l->str, (const char *)s, len);
LL_APPEND(ctx->cfg->identity.nicks, l);
return 1;
}
case ROOT_CONFIG_IDENTITY_NAME:
rpcfg_mkstr(ctx->pool, &ctx->cfg->identity.name, (const char *)s, len);
ctx->state = ROOT_CONFIG_IDENTITY;
return 1;
case ROOT_CONFIG_IDENTITY_LOGIN:
rpcfg_mkstr(ctx->pool, &ctx->cfg->identity.login, (const char *)s, len);
ctx->state = ROOT_CONFIG_IDENTITY;
return 1;
break;
case ROOT_CONFIG_SERVERS_ITEMS_HOST:
rpcfg_mkstr(ctx->pool, &ctx->server->host, (const char *)s, len);
ctx->state = ROOT_CONFIG_SERVERS_ITEMS;
return 1;
case ROOT_CONFIG_SERVERS_ITEMS_PORT:
rpcfg_mkstr(ctx->pool, &ctx->server->port, (const char *)s, len);
ctx->state = ROOT_CONFIG_SERVERS_ITEMS;
return 1;
case ROOT_CONFIG_CHANNELS_ITEMS:
ctx->channel = rp_pcalloc(ctx->pool, sizeof(*ctx->channel));
ctx->channel->key.len = 0;
rpcfg_mkstr(ctx->pool, &ctx->channel->name, (const char *)s, len);
LL_APPEND(ctx->cfg->channels, ctx->channel);
return 1;
default:
return 0;
}
return 1;
}
开发者ID:skroll,项目名称:rpbot,代码行数:42,代码来源:rp_config.c
示例14: pubsub_url_cb
int pubsub_url_cb(char *value)
{
struct pubsub_url *ps_url;
ps_url = malloc(sizeof(struct pubsub_url));
ps_url->address = strdup(value);
ps_url->id = num_pubsub_urls;
LL_APPEND(pubsub_urls, ps_url);
num_pubsub_urls++;
return 1;
}
开发者ID:LevinLin,项目名称:simplehttp,代码行数:11,代码来源:ps_to_http.c
示例15: load_rules
/* Loads a list of allowed hostnames and ports from file. Format is hostname:port*/
void load_rules()
{
char *ahost=NULL;
int aport=0;
char line[100 + 1] = "";
FILE *file = NULL;
rule *rule_obj = NULL;
int valid_rules = 0;
file = fopen(rules_file, "r");
if (file == NULL) {
log_printf(L_WARNING, "Could not open rules file (%s)\n", rules_file);
return;
}
while (fgets(line, sizeof(line), file)) {
/* allow comments & white lines */
if (line[0]=='#'||line[0]=='\n') {
continue;
}
if (parse_pipe_port_forward(line, &ahost, &aport) >= 0) {
if (aport > 0 && aport < 65535) {
rule_obj = (rule *)calloc(sizeof(rule), 1);
if(!rule_obj)
{
log_printf(L_ERROR, "Could not allocate memory for rule");
exit(1);
}
rule_obj->port = aport;
rule_obj->host = strdup(ahost);
LL_APPEND(rules, rule_obj);
valid_rules++;
} else {
log_printf(L_WARNING, "Invalid port in line: %s\n", line);
}
} else {
log_printf(L_WARNING, "Could not parse line: %s\n", line);
}
}
fclose(file);
/* save valid rules in global variable */
nrules = valid_rules;
log_printf(L_INFO, "Loaded %d rules\n", nrules);
if (nrules==0 && rules_policy != NONE){
log_printf(L_WARNING, "No rules loaded! NO CONNECTIONS WILL BE ALLOWED!\n");
}
}
开发者ID:gjedeer,项目名称:tuntox,代码行数:54,代码来源:main.c
示例16: initClasspathEntries
static jboolean initClasspathEntries(Env* env, char* basePath, char** raw, ClasspathEntry** first) {
jint i = 0;
while (raw[i]) {
ClasspathEntry* entry = rvmAllocateMemoryAtomicUncollectable(env, sizeof(ClasspathEntry));
if (!entry) return FALSE;
absolutize(basePath, raw[i], entry->jarPath);
LL_APPEND(*first, entry);
i++;
}
return TRUE;
}
开发者ID:rover12421,项目名称:robovm,代码行数:12,代码来源:init.c
示例17: db_change_location
void
db_change_location(Objid oid, Objid location)
{
Objid old_location = objects[oid]->location;
if (valid(old_location))
LL_REMOVE(old_location, contents, oid, next);
if (valid(location))
LL_APPEND(location, contents, oid, next);
objects[oid]->location = location;
}
开发者ID:welterde,项目名称:NuMOO,代码行数:13,代码来源:db_objects.c
示例18: pocl_command_enqueue
void pocl_command_enqueue (cl_command_queue command_queue,
_cl_command_node *node)
{
POCL_LOCK_OBJ(command_queue);
LL_APPEND (command_queue->root, node);
POCL_UNLOCK_OBJ(command_queue);
#ifdef POCL_DEBUG_BUILD
if (pocl_is_option_set("POCL_IMPLICIT_FINISH"))
POclFinish (command_queue);
#endif
POCL_UPDATE_EVENT_QUEUED (&node->event);
}
开发者ID:larsmans,项目名称:pocl,代码行数:13,代码来源:pocl_util.c
示例19: TWAddTWSock
TWResultCode TWAddTWSock(TWSock * sock, PIPlugin_Zigbee * plugin, const char * fileLoc)
{
if(!sock || !plugin || !fileLoc)
{
return TW_RESULT_ERROR_INVALID_PARAMS;
}
TWSock * out = NULL;
TWSock * temp = NULL;
LL_FOREACH_SAFE(g_twSockList, out, temp)
{
if(out == sock)
{
// Ignore requests to add a socket that's already in the queue.
return TW_RESULT_OK;
}
}
sock->plugin = plugin;
sock->fd = open(fileLoc, O_RDWR | O_NOCTTY | O_SYNC);
if(sock->fd <= 0)
{
OC_LOG_V(INFO, TAG, "Could not open port. Errno is: %d\n", errno);
return TW_RESULT_ERROR;
}
// set speed to 19,200 bps, 8n1 (no parity), no blocking.
int ret = SetTerminalInfo(sock->fd, DEVICE_BAUDRATE, 0, 0);
if(ret != 0)
{
TWResultCode result = TWCloseTWSock(sock);
if(result != TW_RESULT_OK)
{
return result;
}
return TW_RESULT_ERROR;
}
sock->buffer = NULL;
sock->queue = NULL;
pthread_mutexattr_t mutexAttr;
pthread_mutexattr_init(&mutexAttr);
pthread_mutexattr_settype(&mutexAttr, PTHREAD_MUTEX_ERRORCHECK);
pthread_mutex_init(&(sock->mutex), &mutexAttr); // TODO: Use OIC_MUTEX instead.
pthread_cond_init(&(sock->queueCV), NULL);
sock->next = NULL;
sock->isActive = true;
LL_APPEND(g_twSockList, sock);
return TW_RESULT_OK;
}
开发者ID:KonexyIoT,项目名称:iotivity,代码行数:51,代码来源:twsocketlist.c
示例20: process_list_processes
int process_list_processes(process_list_t **result) {
proc_t proc_info;
#ifdef COLLECT_STATS
size_t proc_count = 0;
extern stats_t stats;
struct timeval tv1;
gettimeofday(&tv1, NULL);
#endif
PROCTAB *proc =
openproc(PROC_FILLMEM | PROC_FILLSTAT | PROC_FILLSTATUS | PROC_FILLCOM);
memset(&proc_info, 0, sizeof(proc_info));
while (readproc(proc, &proc_info) != NULL) {
process_t *to_add = calloc(1, sizeof(process_t));
to_add->tgid = proc_info.tgid;
to_add->name = proc_info.cmd;
if (proc_info.cmdline != NULL) {
to_add->cmdline = strjoinv(" ", proc_info.cmdline);
}
to_add->vms = proc_info.vm_size;
to_add->rss = proc_info.vm_rss;
to_add->threads_num = proc_info.nlwp;
to_add->utime = proc_info.utime;
to_add->stime = proc_info.stime;
to_add->user = proc_info.euid;
#ifdef COLLECT_STATS
proc_count++;
#endif
LL_APPEND((*result)->processes, to_add);
// printf("%20s:\t%5ld\t%5lld\t%5lld\n", proc_info.cmd, proc_info.resident,
// proc_info.utime, proc_info.stime);
}
closeproc(proc);
struct timeval tv;
gettimeofday(&tv, NULL);
(*result)->timestamp = 1000000 * tv.tv_sec + tv.tv_usec;
#ifdef COLLECT_STATS
uint64_t t1 = 1000000 * tv1.tv_sec + tv1.tv_usec;
stats.ps_dur = (*result)->timestamp - t1;
stats.ps_times_count += 1;
stats.ps_last_count = proc_count;
#endif
return 1;
}
开发者ID:ilbanshee,项目名称:panopticon,代码行数:51,代码来源:linux_process.c
注:本文中的LL_APPEND函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论