Exemplo n.º 1
0
enum CXChildVisitResult parentedDeclAndRefListBuilder(CXCursor cursor,
                                                      CXCursor parent,
                                                      CXClientData clientData)
{
  ParentedCursorListPair* declsAndRefs = (ParentedCursorListPair*) clientData;

  if (clang_isDeclaration(clang_getCursorKind(cursor))) {
    ParentedCursor newEntry = {
      parent,
      cursor
    };

    ParentedCursorList* decls = &declsAndRefs->decls;
    LIST_APPEND(ParentedCursor, decls, newEntry);
  }

  if (clang_isReference(clang_getCursorKind(cursor))) {
    ParentedCursor newEntry = {
      parent,
      cursor
    };

    ParentedCursorList* refs = &declsAndRefs->refs;
    LIST_APPEND(ParentedCursor, refs, newEntry);
  }

  return CXChildVisit_Recurse;
}
Exemplo n.º 2
0
enum CXChildVisitResult childListBuilder(CXCursor cursor, CXCursor parent,
                                         CXClientData clientData)
{
  CursorList* childList = (CursorList*) clientData;
  LIST_APPEND(CXCursor, childList, cursor);
  return CXChildVisit_Continue;
}
Exemplo n.º 3
0
enum CXChildVisitResult descendantListBuilder(CXCursor cursor, CXCursor parent,
                                              CXClientData clientData)
{
  CursorList* childList = (CursorList*) clientData;
  LIST_APPEND(CXCursor, childList, cursor);
  return CXChildVisit_Recurse;
}
Exemplo n.º 4
0
struct list * get_rib_routes()
{
    sisis_dump_kernel_routes();
    struct listnode * node;
    struct listnode * appnd_node;
    struct list * addr_list = calloc(1, sizeof(struct list));

    LIST_FOREACH(ipv4_rib_routes, node)
    {
        struct route_ipv4 * route = (struct route_ipv4 *)node->data;
        struct addr * cur_addr;

        // Set up prefix
        char prefix_str[INET_ADDRSTRLEN];
        if (inet_ntop(AF_INET, &(route->p->prefix.s_addr), prefix_str, INET_ADDRSTRLEN) != 1)
        {
            cur_addr = parse_ip_address(prefix_str);
            if(strcmp(cur_addr->pre, "26") == 0)
            {
                appnd_node = calloc(1, sizeof(struct listnode));
                appnd_node->data = (void *) cur_addr;
                LIST_APPEND(addr_list, appnd_node);
            }
            else
            {
                free(cur_addr);
                cur_addr = NULL;
            }
        }
    }

    return addr_list;
}
Exemplo n.º 5
0
inline static void* _win32_allocMem( size_t memSize )
{
    const size_t pageRegionRequestSize = _win32_getRealPageSize( memSize );

    _memIntro *mem = (_memIntro*)_win32_allocMemPage( pageRegionRequestSize );
    _memOutro *outro = (_memOutro*)( (unsigned char*)( mem + 1 ) + memSize );

#ifdef PAGE_HEAP_ERROR_ON_LOWMEM
    MEM_INTERRUPT( mem == NULL );
#else
    if ( mem == NULL )
        return NULL;
#endif //PAGE_HEAP_ERROR_ON_LOWMEM

    // Fill memory with debug pattern
    {
        size_t metaSize = _getMetaSize( memSize );

        memset( mem, PAGE_MEM_ACTIVE_DEBUG_PATTERN, metaSize );
        memset( outro + 1, PAGE_MEM_DEBUG_PATTERN, pageRegionRequestSize - metaSize );
    }

    mem->checksum = 0xCAFEBABE;
    mem->objSize = memSize;
    LIST_APPEND( g_privateMemory.root, mem->memList );

    outro->checksum = 0xBABECAFE;

    return mem + 1;
}
Exemplo n.º 6
0
int ffsox_source_append(source_t *si, packet_consumer_t *pc)
{
  packet_consumer_list_t consumer;
#if defined (PBU_DEBUG) // [
  ffsox_packet_consumer_list_t *n;
  packet_consumer_t *consumer_cur;
#endif // ]

  consumer.consumer=pc;

//DVWRITELN("pc->vmt->name: \"%s\"",pc->vmt->name);
  if (LIST_APPEND(si->consumer.h,consumer)<0) {
    DMESSAGE("appending chain");
    goto append;
  }

  pc->prev=si;

#if defined (PBU_DEBUG) // [
  for (n=si->consumer.h;n;LIST_NEXT(&n,si->consumer.h)) {
    consumer_cur=n->consumer;
//DVWRITELN("consumer_cur->vmt->name: \"%s\", consumer_cur->si.stream_index: %d",consumer_cur->vmt->name,consumer_cur->si.stream_index);
    (void)consumer_cur;
  }
#endif // ]

  return 0;
append:
  return -1;
}
int address_new_static(Network *network, unsigned section, Address **ret) {
        _cleanup_address_free_ Address *address = NULL;

        if (section) {
                address = hashmap_get(network->addresses_by_section, UINT_TO_PTR(section));
                if (address) {
                        *ret = address;
                        address = NULL;

                        return 0;
                }
        }

        address = new0(Address, 1);
        if (!address)
                return -ENOMEM;

        address_init(address);

        address->network = network;

        LIST_APPEND(addresses, network->static_addresses, address);

        if (section) {
                address->section = section;
                hashmap_put(network->addresses_by_section,
                            UINT_TO_PTR(address->section), address);
        }

        *ret = address;
        address = NULL;

        return 0;
}
Exemplo n.º 8
0
/* Either of the permitted or excluded subtree pointers may be NULL, to
   be considered undefined. */
void
ssh_x509_cert_set_name_constraints(SshX509Certificate c,
                                   SshX509GeneralSubtree permitted,
                                   SshX509GeneralSubtree excluded,
                                   Boolean critical)
{
  if (permitted)
    LIST_APPEND(SshX509GeneralSubtreeStruct,
                c->extensions.name_const_permitted, permitted);
  if (excluded)
    LIST_APPEND(SshX509GeneralSubtreeStruct,
                c->extensions.name_const_excluded, excluded);
  if (permitted || excluded)
    ssh_x509_ext_info_set(&c->extensions.ext_available,
                          &c->extensions.ext_critical,
                          SSH_X509_EXT_NAME_CNST, critical);
}
Exemplo n.º 9
0
enum CXChildVisitResult referenceListBuilder(CXCursor cursor, CXCursor parent,
                                              CXClientData clientData)
{
  if (clang_isReference(clang_getCursorKind(cursor))) {
    CursorList* childList = (CursorList*) clientData;
    LIST_APPEND(CXCursor, childList, cursor);
  }
  return CXChildVisit_Recurse;
}
Exemplo n.º 10
0
void
ssh_x509_cert_set_crl_dist_points(SshX509Certificate c,
                                  SshX509ExtCRLDistPoints dps,
                                  Boolean critical)
{
  LIST_APPEND(SshX509ExtCRLDistPointsStruct, c->extensions.crl_dp, dps);
  ssh_x509_ext_info_set(&c->extensions.ext_available,
                        &c->extensions.ext_critical,
                        SSH_X509_EXT_CRL_DIST_POINTS, critical);
}
Exemplo n.º 11
0
void
ssh_x509_cert_set_policy_info(SshX509Certificate c,
                              SshX509ExtPolicyInfo pinfo,
                              Boolean critical)
{
  LIST_APPEND(SshX509ExtPolicyInfoStruct, c->extensions.policy_info, pinfo);
  ssh_x509_ext_info_set(&c->extensions.ext_available,
                        &c->extensions.ext_critical,
                        SSH_X509_EXT_CERT_POLICIES, critical);
}
Exemplo n.º 12
0
void
ssh_x509_cert_set_subject_info_access(SshX509Certificate c,
                                      SshX509ExtInfoAccess access,
                                      Boolean critical)
{
  LIST_APPEND(SshX509ExtInfoAccessStruct,
              c->extensions.subject_info_access, access);
  ssh_x509_ext_info_set(&c->extensions.ext_available,
                        &c->extensions.ext_critical,
                        SSH_X509_EXT_SUBJECT_INFO_ACCESS, critical);
}
Exemplo n.º 13
0
void
ssh_x509_cert_set_policy_mappings(SshX509Certificate c,
                                  SshX509ExtPolicyMappings pmappings,
                                  Boolean critical)
{
  LIST_APPEND(SshX509ExtPolicyMappingsStruct,
              c->extensions.policy_mappings, pmappings);
  ssh_x509_ext_info_set(&c->extensions.ext_available,
                        &c->extensions.ext_critical,
                        SSH_X509_EXT_POLICY_MAPPINGS, critical);
}
Exemplo n.º 14
0
void
ssh_x509_cert_set_freshest_crl(SshX509Certificate c,
                               SshX509ExtCRLDistPoints fresh,
                               Boolean critical)
{
  LIST_APPEND(SshX509ExtCRLDistPointsStruct,
              c->extensions.freshest_crl, fresh);
  ssh_x509_ext_info_set(&c->extensions.ext_available,
                        &c->extensions.ext_critical,
                        SSH_X509_EXT_FRESHEST_CRL, critical);
}
Exemplo n.º 15
0
void
chunk_append_free(struct malloc_infos *list, struct chunk *chunk)
{
  int i;

  i = free_bucket(chunk->size);
  LIST_APPEND(list->lfree[i], chunk, free);
  list->lfree_cnt[i]++;
  chunk->type = MALLOC_CHUNK_FREE;
  chunk->asked_size = 0;
}
Exemplo n.º 16
0
void
ssh_x509_cert_set_ext_key_usage(SshX509Certificate c,
                                SshX509OidList ext_key_usage,
                                Boolean critical)
{
  LIST_APPEND(SshX509OidListStruct,
              c->extensions.ext_key_usage, ext_key_usage);
  ssh_x509_ext_info_set(&c->extensions.ext_available,
                        &c->extensions.ext_critical,
                        SSH_X509_EXT_EXT_KEY_USAGE, critical);
}
Exemplo n.º 17
0
void
ssh_x509_cert_set_subject_directory_attr(SshX509Certificate c,
                                         SshX509ExtDirAttribute subject_dattr,
                                         Boolean critical)
{
  LIST_APPEND(SshX509ExtDirAttributeStruct,
              c->extensions.subject_directory_attr, subject_dattr);
  ssh_x509_ext_info_set(&c->extensions.ext_available,
                        &c->extensions.ext_critical,
                        SSH_X509_EXT_SUBJECT_DIR_ATTR, critical);
}
Exemplo n.º 18
0
void TextureBase::AddToDictionary( TexDictionary *dict )
{
    this->RemoveFromDictionary();

    // Note: original RenderWare performs an insert, not an append.
    // I switched this around, so that textures stay in the correct order.
    LIST_APPEND( dict->textures.root, texDictNode );

    dict->numTextures++;

    this->texDict = dict;
}
Exemplo n.º 19
0
void display_windows(struct list * addr_list, int argc, char * argv[])
{
  struct listnode * addr_node;
  struct listnode * local_addr_node;

  LIST_FOREACH(addr_list, addr_node)
  {
    struct addr * cur_addr = (struct addr *)addr_node->data;
    if(strcmp(cur_addr->type, "1") == 0)
    {
      char * host = cur_addr->host;
      struct list * addr_list_procs = calloc(1, sizeof(struct list));

      LIST_FOREACH(addr_list, local_addr_node)
      {
        struct addr * local_cur_addr = (struct addr *)local_addr_node->data;
        if((strcmp(local_cur_addr->type, "1") != 0) && (strcmp(local_cur_addr->host, host) == 0))
        {
          printf("%s\n", local_cur_addr->prefix_str);
          struct listnode * node_to_be_added = calloc(1, sizeof(struct listnode));
          struct addr * addr_to_be_added = calloc(1, sizeof(struct addr));
          node_to_be_added->data = (void *)addr_to_be_added;

          memcpy(addr_to_be_added, local_cur_addr, sizeof(struct addr));
          printf("memcpied %s\n", addr_to_be_added->prefix_str);
          LIST_APPEND(addr_list_procs, node_to_be_added);
        }
      }

      LIST_FOREACH(addr_list_procs, local_addr_node)
      {
        struct addr * local_cur_addr = (struct addr *)local_addr_node->data;
        printf("address copied: %s\n", local_cur_addr->prefix_str);
      }

      // create new child for each window
      pid_t pid = fork();

      if(pid == 0)
      {

        if (!g_thread_supported ()){ g_thread_init(NULL); }
        gdk_threads_init();
        gdk_threads_enter();

        gtk_init(&argc, &argv);
        display_window(cur_addr, addr_list_procs);
        gdk_threads_leave();
        // make sure child doesn't fork again
        _exit(0);
      }
    }
  }
Exemplo n.º 20
0
enum CXChildVisitResult parentedDescendantListBuilder(CXCursor cursor, CXCursor parent,
                                                      CXClientData clientData)
{
  ParentedCursorList* descendantList = (ParentedCursorList*) clientData;

  ParentedCursor newEntry = {
    parent,
    cursor
  };

  LIST_APPEND(ParentedCursor, descendantList, newEntry);

  return CXChildVisit_Recurse;
}
Exemplo n.º 21
0
int prefix_new_static(Network *network, const char *filename,
                      unsigned section_line, Prefix **ret) {
        _cleanup_network_config_section_free_ NetworkConfigSection *n = NULL;
        _cleanup_prefix_free_ Prefix *prefix = NULL;
        int r;

        assert(network);
        assert(ret);
        assert(!!filename == (section_line > 0));

        if (filename) {
                r = network_config_section_new(filename, section_line, &n);
                if (r < 0)
                        return r;

                if (section_line) {
                        prefix = hashmap_get(network->prefixes_by_section, n);
                        if (prefix) {
                                *ret = prefix;
                                prefix = NULL;

                                return 0;
                        }
                }
        }

        r = prefix_new(&prefix);
        if (r < 0)
                return r;

        if (filename) {
                prefix->section = n;
                n = NULL;

                r = hashmap_put(network->prefixes_by_section, prefix->section,
                                prefix);
                if (r < 0)
                        return r;
        }

        prefix->network = network;
        LIST_APPEND(prefixes, network->static_prefixes, prefix);
        network->n_static_prefixes++;

        *ret = prefix;
        prefix = NULL;

        return 0;
}
Exemplo n.º 22
0
static int prefix_new_static(Network *network, const char *filename,
                             unsigned section_line, Prefix **ret) {
        _cleanup_(network_config_section_freep) NetworkConfigSection *n = NULL;
        _cleanup_(prefix_freep) Prefix *prefix = NULL;
        int r;

        assert(network);
        assert(ret);
        assert(!!filename == (section_line > 0));

        if (filename) {
                r = network_config_section_new(filename, section_line, &n);
                if (r < 0)
                        return r;

                if (section_line) {
                        prefix = hashmap_get(network->prefixes_by_section, n);
                        if (prefix) {
                                *ret = TAKE_PTR(prefix);

                                return 0;
                        }
                }
        }

        r = prefix_new(&prefix);
        if (r < 0)
                return r;

        prefix->network = network;
        LIST_APPEND(prefixes, network->static_prefixes, prefix);
        network->n_static_prefixes++;

        if (filename) {
                prefix->section = TAKE_PTR(n);

                r = hashmap_ensure_allocated(&network->prefixes_by_section, &network_config_hash_ops);
                if (r < 0)
                        return r;

                r = hashmap_put(network->prefixes_by_section, prefix->section, prefix);
                if (r < 0)
                        return r;
        }

        *ret = TAKE_PTR(prefix);

        return 0;
}
Exemplo n.º 23
0
static Snapshot    *
_SnapCreate(const char *name)
{
   Snapshot           *sn;

   sn = ECALLOC(Snapshot, 1);
   if (!sn)
      return NULL;

   LIST_APPEND(Snapshot, &ss_list, sn);

   sn->name = Estrdup(name);

   return sn;
}
Exemplo n.º 24
0
void
ssh_x509_cert_set_unknown_extension(SshX509Certificate c,
                                    SshX509ExtUnknown unknown)
{
  Boolean critical;

  LIST_APPEND(SshX509ExtUnknownStruct, c->extensions.unknown, unknown);
  /* Get existing criticality bit and 'or' it with criticality bit from
     this extension. */
  if (!ssh_x509_cert_ext_available(c, SSH_X509_EXT_UNKNOWN, &critical))
    critical = FALSE;
  ssh_x509_ext_info_set(&c->extensions.ext_available,
                        &c->extensions.ext_critical,
                        SSH_X509_EXT_UNKNOWN,
                        critical ? TRUE : unknown->critical);
}
Exemplo n.º 25
0
enum CXChildVisitResult parentedReferenceListBuilder(CXCursor cursor, CXCursor parent,
                                                      CXClientData clientData)
{
  ParentedCursorList* referenceList = (ParentedCursorList*) clientData;

  if (clang_isReference(clang_getCursorKind(cursor))) {
    ParentedCursor newEntry = {
      parent,
      cursor
    };

    LIST_APPEND(ParentedCursor, referenceList, newEntry);
  }

  return CXChildVisit_Recurse;
}
Exemplo n.º 26
0
void inclusionListBuilder(CXFile includedFile, CXSourceLocation* inclusionStack,
                          unsigned stackLen, CXClientData clientData)
{
  // Skip the initial file.
  if (stackLen == 0)
    return;
  
  InclusionList* inclusionList = (InclusionList*) clientData;

  Inclusion newEntry = {
    includedFile,
    inclusionStack[0],
    stackLen == 1  // It's a direct inclusion if there's only one stack entry.
  };

  LIST_APPEND(Inclusion, inclusionList, newEntry);
}
Exemplo n.º 27
0
/*=========================================================
    CPlaceableSAInterface::AllocateMatrix

    Purpose:
        Allocates a static matrix to this entity. Static matrices
        are not automatically deallocated when there is a matrix
        shortage. If the entity already had a transform matrix,
        the engine ensures that it is a static matrix.
    Binary offsets:
        (1.0 US and 1.0 EU): 0x0054F4C0
=========================================================*/
void CPlaceableSAInterface::AllocateMatrix( void )
{
    if ( Placeable.matrix )
    {
        // We already have a matrix, make sure its in the active list
        LIST_REMOVE( *Placeable.matrix );
        LIST_APPEND( pTransform->m_activeList, *Placeable.matrix );
        return;
    }

    // Extend the matrix list
    if ( !pTransform->IsFreeMatrixAvailable() && !pTransform->FreeUnimportantMatrix() )
        pTransform->NewMatrix();

    // Allocate it
    Placeable.matrix = pTransform->AllocateStatic();
    Placeable.matrix->m_entity = this;
}
Exemplo n.º 28
0
static int parse_drhd_u(struct acpi_ent_drhd *ent)
{
	struct acpi_ent_drhd *drhd = ent;
	struct acpi_drhd_u *drhd_u;
	static int include_pci_all;
	void *sp, *ep;
	int ret = 0;

	drhd_u = alloc(sizeof(struct acpi_drhd_u));
	if (!drhd_u)
		return -ENOMEM;
	memset(drhd_u, 0, sizeof(struct acpi_drhd_u));

	drhd_u->address = drhd->address;

#ifdef VTD_DEBUG
	printf("(DMAR) Register base address = %llx\n", drhd_u->address);
#endif // of VTD_DEBUG
	if (drhd->flags & 1) {
		drhd_u->include_pci_all = 1 ;
#ifdef VTD_DEBUG
		printf("(DMAR) Including ALL the other PCI devices.\n");
#endif // of VTD_DEBUG

		if (include_pci_all)
		{
			printf("(DMAR) There should be only one INCLUDE_PCI_ALL DRHD!!\n");
			ret = -EINVAL;
		}
		include_pci_all = 1;
	} else {
		drhd_u->include_pci_all = 0 ;
		sp = (void *)(drhd + 1);
		ep   = ((void *)drhd) + ent->length;
		ret = parse_dev_scope(sp, ep, drhd_u);
	}

	if (ret)
		free(drhd_u);
	else
		LIST_APPEND(drhd_list, drhd_u);

	return ret;
}
Exemplo n.º 29
0
/*=========================================================
    CPlaceableSAInterface::FreeMatrix

    Purpose:
        Stores the matrix as z-rotation heading and position
        members while adding it to the free-list of the
        transformation matrix cache.
    Binary offsets:
        (1.0 US and 1.0 EU): 0x0054F3B0
=========================================================*/
void CPlaceableSAInterface::FreeMatrix( void )
{
    CTransformSAInterface *trans = Placeable.matrix;

    // Crashfix: do nothing if we have no transformation.
    if ( !trans )
        return;

    // Transform the entity
    Placeable.m_transform.m_translate = trans->vPos;
    Placeable.m_transform.m_heading = trans->ToHeading();

    // Free the matrix
    Placeable.matrix = NULL;
    trans->m_entity = NULL;

    LIST_REMOVE( *trans );
    LIST_APPEND( pTransform->m_freeList, *trans );
}
Exemplo n.º 30
0
static int address_label_new_static(Network *network, const char *filename, unsigned section_line, AddressLabel **ret) {
        _cleanup_network_config_section_free_ NetworkConfigSection *n = NULL;
        _cleanup_address_label_free_ AddressLabel *label = NULL;
        int r;

        assert(network);
        assert(ret);
        assert(!!filename == (section_line > 0));

        r = network_config_section_new(filename, section_line, &n);
        if (r < 0)
                return r;

        label = hashmap_get(network->address_labels_by_section, n);
        if (label) {
                *ret = label;
                label = NULL;

                return 0;
        }

        r = address_label_new(&label);
        if (r < 0)
                return r;

        label->section = n;
        n = NULL;

        r = hashmap_put(network->address_labels_by_section, label->section, label);
        if (r < 0)
                return r;

        label->network = network;
        LIST_APPEND(labels, network->address_labels, label);
        network->n_address_labels++;

        *ret = label;
        label = NULL;

        return 0;
}