Exemplo n.º 1
0
static void create_entry(PROC_T *p){
    p->hbox=gtk_hbox_new(FALSE,0);
    char lb[12];
    char stime[80];
    snprintf(lb,12," %5d",p->pid);
    struct tm *tim=localtime(&(p->status.timstart));
    strftime(stime,80,"[%F %k:%M:%S]",tim);
    strcat(stime,lb);
    p->entry_pid=new_label(stime,WIDTH_PID,0);
    p->entry_path=new_label(p->path,WIDTH_PATH,1);
    gtk_label_set_selectable(GTK_LABEL(p->entry_path), TRUE);
    gtk_label_set_ellipsize(GTK_LABEL(p->entry_path),PANGO_ELLIPSIZE_START);
#if GTK_MAJOR_VERSION>=3 || GTK_MINOR_VERSION >= 12
    gtk_widget_set_tooltip_text(p->entry_path, p->path);
#endif
    p->entry_errlo=new_label("Lo (nm)",WIDTH_ERRLO,1);
    p->entry_errhi=new_label("Hi (nm)",WIDTH_ERRHI,1);
    p->entry_iseed=new_entry("iSEED",WIDTH_ISEED,0.5);
    p->entry_timing=new_entry("Timing",WIDTH_TIMING,1);
    /*kill_button_new(p); */
    change_button(p, GTK_STOCK_STOP, (GCallback)kill_job_event);
    int irow=nrows[p->hid];
    nrows[p->hid]++;
    gtk_table_resize(GTK_TABLE(tables[p->hid]), nrows[p->hid],ncol);
    grid_attach(tables[p->hid], p->entry_pid, 0,1,irow,irow+1,0);
    grid_attach(tables[p->hid], p->entry_path, 1,2,irow,irow+1,7);
    grid_attach(tables[p->hid], p->entry_errlo, 2,3,irow,irow+1,0);
    grid_attach(tables[p->hid], p->entry_errhi, 3,4,irow,irow+1,0);
    grid_attach(tables[p->hid], p->entry_iseed, 4,5,irow,irow+1,0);
    grid_attach(tables[p->hid], p->entry_timing, 5,6,irow,irow+1,0);
    grid_attach(tables[p->hid], p->btn, 6,7,irow,irow+1,0);
    gtk_widget_show_all(tables[p->hid]);
    gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook),p->hid);
}
Exemplo n.º 2
0
atf_error_t
atf_list_init(atf_list_t *l)
{
    struct list_entry *lebeg, *leend;

    lebeg = new_entry(NULL, false);
    if (lebeg == NULL) {
        return atf_no_memory_error();
    }

    leend = new_entry(NULL, false);
    if (leend == NULL) {
        free(lebeg);
        return atf_no_memory_error();
    }

    lebeg->m_next = leend;
    lebeg->m_prev = NULL;

    leend->m_next = NULL;
    leend->m_prev = lebeg;

    l->m_size = 0;
    l->m_begin = lebeg;
    l->m_end = leend;

    return atf_no_error();
}
Exemplo n.º 3
0
Arquivo: split.c Projeto: ysei/blib
int split(char *buf, char *sep,list_t **flds)
{
    int		rval, eol;
    char        *sp, qchar, *fldptr, *fld;
    entry_t	*ent;

    qchar ='\0';
    sp = buf;
    eol= FALSE;
    rval = SPLIT_OK;
    fldptr = sp;
    while ( !eol ) {
        switch(*sp) {
        case '\"':
            if ( qchar == '\"' ) { // this must be a closing quote
                qchar = '\0'; // stop quote
            } else { // not already in a quote
                qchar = '\"';	 // set quote char
            }
            break;

        case '\'':
            if ( qchar == '\"' ) { // this must be a closing quote
                qchar = '\0'; /* no longer quote */
            } else { // not already in a quote
                qchar = '\"';	 // set quote char
            }
            break;

        case '\n':
        case '\r':
            *sp='\0'; /* null it and fall through */
        case '\0':
            if ( qchar != '\0' ) { // have a start of quoted text but found eol before closing
                rval=SPLIT_MISSQUOT;
            }
            fld = newfld(fldptr);
            ent = new_entry(fld);
            list_insert_tail(flds, ent);
            eol = TRUE; // and we done
            break;

        default: /* anything else must be start of non quoted field */
            if ( qchar == '\0' ) { // if not quoting then we can look for sep
                if (index(sep,*sp) != (char *) NULL ) {
                    *sp='\0';	// null terminate it as a C String
                    fld = newfld(fldptr);
                    ent = new_entry(fld);
                    list_insert_tail(flds, ent);

                    fldptr = (sp+1); // set a point to the start
                }
            }
            break;
        }
        sp++; /* next char */
    }
    return(rval);
}
Exemplo n.º 4
0
void menu()
{
    u32 index;

    new_unselectable_entry("ACNL Cheats 2.2");//USA
    new_spoiler("Inventory Codes");
            index = new_entry("Text to Item", text2item_usa);
        set_note(TEXT_ITEM_NOTE, index);
        new_entry("Duplication", duplicate_usa);
    exit_spoiler();
    new_spoiler("Movement Codes");
        index = new_entry("Moon Jump", moonjump_usa);
        set_note(MOON_JUMP_NOTE, index);
        new_entry("Teleport", teleport_usa);
        new_entry("Coordinates Modifier", coord_usa);
        index = new_entry("Speed Hack", speed_usa);
        set_note(SPEED_HACK_NOTE, index);
    exit_spoiler();
    new_spoiler("Enviroment Codes");
        new_entry("Seeder", seed_usa);
        new_entry("Search and Replace", search_usa);
        index = new_entry("Instant Tree", tree_usa);
        set_note(INSTANT_TREE_NOTE, index);
    exit_spoiler();
}
Exemplo n.º 5
0
static inline void  smenu(void)
{
    update_tan_entry();
    new_entry_with_note("Warning ! Read the notes !", warning_note, keep_it_off);
    new_entry("Text to cheat", text_to_cheats);
    new_spoiler_with_note("Environment Codes", enviro_note);
        new_spoiler("R + A Codes");
            new_radio_entry_with_note("Remove all weeds", weed_note, weeder);
            new_radio_entry_with_note("Water all flowers", flwr_note, quench);
            new_radio_entry_with_note("Grass", lush_note, grass);
            new_radio_entry_with_note("Desert", des_note, desert);
        exit_spoiler();
        new_entry_with_note("Real Time World Edit", real_note, real);
        new_entry_with_note("Seeder", seed_note, seeder);
        new_entry_with_note("Search and Replace", sar_note, search);
        new_entry_with_note("Instant Tree", tree_note, tree);
    exit_spoiler();
    new_spoiler("Inventory Codes");
        new_entry_with_note("Text to Item", t2i_note, text2item);
        new_entry_with_note("Duplication", dup_note, duplicate);
    exit_spoiler();
    new_spoiler("Apparence Codes");
        new_spoiler_with_note("Tan Modifier", tan_note);
            new_unselectable_entry(tan_level_buffer);
            g_increase_menu_index = new_entry("Increase Tan", increase_tan_level);
            g_decrease_menu_index = new_entry("Decrease Tan", decrease_tan_level);
        exit_spoiler();
    exit_spoiler();
    new_spoiler_with_note("Movement Codes", trans_note);
        new_entry_with_note("Walk Through Walls", cl_note, collisions);
        new_entry_with_note("Warping", warp_note, warping);
        new_entry_with_note("Moon Jump", mj_note, moonjump);
        new_entry_with_note("Coordinates Modifier", cm_note, coord);
        new_entry_with_note("Speed Hack", speed_note, speed);
        new_entry_with_note("Teleport", tele_note, teleport);
    exit_spoiler();
    new_spoiler("Nookling Upgrades");
        new_radio_entry("T&T Mart", nook1);
        new_radio_entry("Super T&T", nook2);
        new_radio_entry("T.I.Y", nook3);
        new_radio_entry("T&T Emporium", nook4);
    exit_spoiler();
    new_spoiler_with_note("Time Travel Codes", time_note);
        new_entry_with_note("Time Travel", tt_note, timeTravel);
        new_entry_with_note("Time Machine", tm_note, timeMachine);
    exit_spoiler();
    new_spoiler("Misc. Codes");
        new_entry_with_note("Edible Items", eat_note,  edibleItems);
    exit_spoiler();

}
Exemplo n.º 6
0
static void create_entry(PROC_T *p){
    p->hbox=gtk_hbox_new(FALSE,0);
    char lb[12];
    snprintf(lb,12," %5d",p->pid);
    struct tm *tim=localtime(&(p->status.timstart));
    char stime[80];
    strftime(stime,80,"[%a %k:%M:%S]",tim);
    p->entry_start=new_label(stime,WIDTH_START,0.5);
    p->entry_pid=new_label(lb,WIDTH_PID,1);
    p->entry_path=new_label(p->path,WIDTH_PATH,1);
    gtk_label_set_selectable(GTK_LABEL(p->entry_path), TRUE);
    gtk_label_set_ellipsize(GTK_LABEL(p->entry_path),PANGO_ELLIPSIZE_START);
#if GTK_MAJOR_VERSION>=3 || GTK_MINOR_VERSION >= 12
    gtk_widget_set_tooltip_text(p->entry_path, p->path);
#endif
    p->entry_errlo=new_label("Lo (nm)",WIDTH_ERRLO,1);
    p->entry_errhi=new_label("Hi (nm)",WIDTH_ERRHI,1);
    gtk_label_set_max_width_chars(GTK_LABEL(p->entry_errlo),WIDTH_ERRLO);
    gtk_label_set_max_width_chars(GTK_LABEL(p->entry_errhi),WIDTH_ERRHI);
    p->entry_iseed=new_entry("seed",WIDTH_ISEED,0.5);
    p->entry_timing=new_entry("Timing",WIDTH_TIMING,1);
    gtk_box_pack_start(GTK_BOX(p->hbox),gtk_vseparator_new(),FALSE,FALSE,0);
    gtk_box_pack_start(GTK_BOX(p->hbox),p->entry_start,FALSE,FALSE,0);
    gtk_box_pack_start(GTK_BOX(p->hbox),gtk_vseparator_new(),FALSE,FALSE,0);
    gtk_box_pack_start(GTK_BOX(p->hbox),p->entry_pid,FALSE,FALSE,0);
    gtk_box_pack_start(GTK_BOX(p->hbox),gtk_vseparator_new(),FALSE,FALSE,0);
    gtk_box_pack_start(GTK_BOX(p->hbox),p->entry_path,TRUE,TRUE,0);
    gtk_box_pack_start(GTK_BOX(p->hbox),gtk_vseparator_new(),FALSE,FALSE,0);
    gtk_box_pack_start(GTK_BOX(p->hbox),p->entry_errlo,FALSE,FALSE,0);
    gtk_box_pack_start(GTK_BOX(p->hbox),gtk_vseparator_new(),FALSE,FALSE,0);
    gtk_box_pack_start(GTK_BOX(p->hbox),p->entry_errhi,FALSE,FALSE,0);
    gtk_box_pack_start(GTK_BOX(p->hbox),gtk_vseparator_new(),FALSE,FALSE,0);
    gtk_box_pack_start(GTK_BOX(p->hbox),p->entry_iseed,FALSE,FALSE,0);
    gtk_box_pack_start(GTK_BOX(p->hbox),gtk_vseparator_new(),FALSE,FALSE,0);
    gtk_box_pack_start(GTK_BOX(p->hbox),p->entry_timing,FALSE,FALSE,0);
    gtk_box_pack_start(GTK_BOX(p->hbox),gtk_vseparator_new(),FALSE,FALSE,0);
    change_button(p, GTK_STOCK_PREFERENCES, (void*)kill_job_event);
    gtk_box_pack_start(GTK_BOX(p->hbox),p->btn,FALSE,FALSE,0);
    p->vbox=gtk_vbox_new(FALSE,0);
    if(nproc[p->hid]==1){
	gtk_box_pack_start(GTK_BOX(p->vbox),gtk_hseparator_new(),FALSE,FALSE,0);
    }
    gtk_box_pack_start(GTK_BOX(p->vbox),p->hbox,FALSE,FALSE,0);
    gtk_box_pack_start(GTK_BOX(p->vbox),gtk_hseparator_new(),FALSE,FALSE,0);
    gtk_box_pack_start(GTK_BOX(pages[p->hid]),p->vbox,FALSE,FALSE,0);
    
    /*gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook),p->hid); */
    gtk_widget_show_all(p->vbox);
}
Exemplo n.º 7
0
lenv_entry* lenv_entry_copy(lenv_entry* src) {
	lenv_entry* dest = new_entry(src->key, src->val);
	if (src->next) {
		dest->next = lenv_entry_copy(src->next);
	}
	return dest;
}
Exemplo n.º 8
0
void lenv_put_by_key(lenv *e, char *k, lval *v) {
    int bin = hash(e, k);
    lenv_entry* next = e->table[bin];
    short found = 0;

    while (next != NULL) {
    	if (next->key != NULL && strcmp(k, next->key) == 0) {
    		lval_del(next->val);
    		next->val = lval_copy(v);
    		found = 1;
    		break;
    	}
    	next = next->next;
    }

    if (found == 0) {
    	lenv_entry* entry = new_entry(k, v);
    	lenv_entry* first = e->table[bin];
		e->table[bin] = entry;
		if (first != NULL) {
			entry->next = first;
		}

    }
}
Exemplo n.º 9
0
static DL intern_delay_list(CPtr dlist) /* assumes that dlist != NULL	*/
{
  DE head = NULL, de;
  DL dl = NULL;

  while (islist(dlist)) {
    dlist = clref_val(dlist);
    if ((de = intern_delay_element(cell(dlist))) != NULL) {
      de_next(de) = head;
      head = de;
    }
    dlist = (CPtr) cell(dlist+1);
  }
  if (head) {
    new_entry(dl,
	      released_dls,
	      next_free_dl,
	      current_dl_block,
	      current_dl_block_top,
	      dl_next,
	      DL,
	      dl_block_size,
	      "Not enough memory to expand DL space");
    dl_de_list(dl) = head;
    dl_asl(dl) = NULL;
    return dl;
  }
  else return NULL;
}
Exemplo n.º 10
0
void    new_entry_note(char *str, const char * const note, void (*function)(void))
{
    int index;

    index = new_entry(str, function);
    set_note((char *)note, index);
}
Exemplo n.º 11
0
int entryTest(void) {
    printf("%s", "====== Entry Test Starts =======\n");

    setlocale (LC_ALL, "");

    json_t *root, *subtree;

    // creates the root node
    root = json_new_object();

    // creates the desired MJSON document subtree
    subtree = new_entry("Andrew", "555 123 456");

    // inserts the subtree into the root object
    json_insert_child(root, subtree);

    // print the result
    char *text;
    json_tree_to_string(root, &text);
    printf("%s\n", text);

    // clean up
    free(text);
    json_free_value(&root);

    printf("%s", "====== Entry Test Ends =======\n");

    return EXIT_SUCCESS;
}
Exemplo n.º 12
0
PUBLIC template<typename T> static inline
T*
Jdb_tbuf::new_entry()
{
  static_assert(sizeof(T) <= sizeof(Tb_entry_union), "tb entry T too big");
  return static_cast<T*>(new_entry());
}
Exemplo n.º 13
0
Cookie_impl*
ReceptaclePort::add_connection (CORBA::Object_ptr connection)
throw (Components::InvalidConnection,
       Components::AlreadyConnected,
       Components::ExceededConnectionLimit)
{
	// Test whether already connected
	if ( !is_multiplex_ && connections_.size() > 0 )
	{
		DEBUG_OUT2 ("ReceptaclePort: Multiple connections not allowed for receptacle ", port_name_);
		throw Components::AlreadyConnected();
	}

	// Test for type of connection
	if (! connection->_is_a (type_id_.c_str()))
	{
		DEBUG_OUT2 ( "ReceptaclePort: Connection has wrong type for receptacle ", port_name_ );
        throw Components::InvalidConnection();
	}

    // Create cookie
	Cookie_impl* new_cookie = new Cookie_impl();

    // Create connection entry
    ReceptacleConnection new_entry (connection, new_cookie);

    connections_.push_back (new_entry);

    return new_cookie;
}
Exemplo n.º 14
0
int
TAO_Transient_Bindings_Map::shared_bind (const char * id,
                                         const char * kind,
                                         CORBA::Object_ptr obj,
                                         CosNaming::BindingType type,
                                         int rebind)
{
  TAO_ExtId new_name (id, kind);
  TAO_IntId new_entry (obj, type);
  TAO_IntId old_entry;

  if (rebind == 0)
    // Do a normal bind.
    return this->map_.bind (new_name, new_entry);

  else
    // Rebind.
    {
      // Check that types of old and new entries match.
      if (this->map_.find (new_name,
                           old_entry) == 0
          && type != old_entry.type_)
        return -2;

      else
        return this->map_.rebind (new_name, new_entry);
    }
}
idn_result_t
idn__strhash_put(idn__strhash_t hash, const char *key, void *value) {
	unsigned long h, h_index;
	strhash_entry_t *entry;

	assert(hash != NULL && key != NULL);

	h = hash_value(key);
	h_index = h % hash->nbins;

	if ((entry = find_entry(hash->bins[h_index], key, h)) != NULL) {
		/* Entry exists.  Replace the value. */
		entry->value = value;
	} else {
		/* Create new entry. */
		if ((entry = new_entry(key, value)) == NULL) {
			return (idn_nomemory);
		}
		/* Insert it to the list. */
		entry->next = hash->bins[h_index];
		hash->bins[h_index] = entry;
		hash->nelements++;

		if (hash->nelements > hash->nbins * THRESHOLD) {
			idn_result_t r;
			r = expand_bins(hash, hash->nbins * FACTOR);
			if (r != idn_success) {
				TRACE(("idn__strhash_put: hash table "
					"expansion failed\n"));
			}
		}
	}

	return (idn_success);
}
Exemplo n.º 16
0
int 
infra_edns_update(struct infra_cache* infra, struct sockaddr_storage* addr,
	socklen_t addrlen, uint8_t* nm, size_t nmlen, int edns_version,
	time_t timenow)
{
	struct lruhash_entry* e = infra_lookup_nottl(infra, addr, addrlen,
		nm, nmlen, 1);
	struct infra_data* data;
	int needtoinsert = 0;
	if(!e) {
		if(!(e = new_entry(infra, addr, addrlen, nm, nmlen, timenow)))
			return 0;
		needtoinsert = 1;
	} else if(((struct infra_data*)e->data)->ttl < timenow) {
		data_entry_init(infra, e, timenow);
	}
	/* have an entry, update the rtt, and the ttl */
	data = (struct infra_data*)e->data;
	/* do not update if noEDNS and stored is yesEDNS */
	if(!(edns_version == -1 && (data->edns_version != -1 &&
		data->edns_lame_known))) {
		data->edns_version = edns_version;
		data->edns_lame_known = 1;
	}

	if(needtoinsert)
		slabhash_insert(infra->hosts, e->hash, e, e->data, NULL);
	else 	{ lock_rw_unlock(&e->lock); }
	return 1;
}
Exemplo n.º 17
0
Arquivo: st.c Projeto: sho-h/ruby
static void
unpack_entries(register st_table *table)
{
    st_index_t i;
    st_packed_entry packed_bins[MAX_PACKED_HASH];
    register st_table_entry *entry, *preventry = 0, **chain;
    st_table tmp_table = *table;

    MEMCPY(packed_bins, PACKED_BINS(table), st_packed_entry, MAX_PACKED_HASH);
    table->as.packed.entries = packed_bins;
    tmp_table.entries_packed = 0;
#if ST_DEFAULT_INIT_TABLE_SIZE == ST_DEFAULT_PACKED_TABLE_SIZE
    MEMZERO(tmp_table.bins, st_table_entry*, tmp_table.num_bins);
#else
    tmp_table.bins = st_realloc_bins(tmp_table.bins, ST_DEFAULT_INIT_TABLE_SIZE, tmp_table.num_bins);
    tmp_table.num_bins = ST_DEFAULT_INIT_TABLE_SIZE;
#endif
    i = 0;
    chain = &tmp_table.head;
    do {
	st_data_t key = packed_bins[i].key;
	st_data_t val = packed_bins[i].val;
	st_index_t hash = packed_bins[i].hash;
	entry = new_entry(&tmp_table, key, val, hash,
			  hash_pos(hash, ST_DEFAULT_INIT_TABLE_SIZE));
	*chain = entry;
	entry->back = preventry;
	preventry = entry;
	chain = &entry->fore;
    } while (++i < MAX_PACKED_HASH);
    *chain = NULL;
    tmp_table.tail = entry;
    *table = tmp_table;
}
Exemplo n.º 18
0
//------------------------------------------------------------------------------
inline bool new_entry(
        frontend& fe, sev::severity sv, proto::str_literal fmt
        )
{
    proto::encoder::null_type no;
    return new_entry(
        fe, sv, fmt, no, no, no, no, no, no, no, no, no, no, no, no, no, no
        );
}
Exemplo n.º 19
0
bool new_entry(
        frontend& fe, sev::severity sv, proto::str_literal fmt, A a, B b, C c
        )
{
    proto::encoder::null_type no;
    return new_entry(
        fe, sv, fmt, a, b, c, no, no, no, no, no, no, no, no, no, no, no
        );
}
Exemplo n.º 20
0
/* Inserts entry by name */
void insert_entry(char* n, tableptr t) {

  entryptr e = new_entry(n);

  insert(e, t);


  
};
ProtectionDomainCacheEntry* ProtectionDomainCacheTable::add_entry(int index, unsigned int hash, oop protection_domain) {
  assert_locked_or_safepoint(SystemDictionary_lock);
  assert(index == index_for(protection_domain), "incorrect index?");
  assert(find_entry(index, protection_domain) == NULL, "no double entry");

  ProtectionDomainCacheEntry* p = new_entry(hash, protection_domain);
  Hashtable<oop, mtClass>::add_entry(index, p);
  return p;
}
Exemplo n.º 22
0
static int set_add(intset_t *set, val_t val, thread_data_t *td)
{
  int result, i;
  bucket_t *b, *first;

# ifdef DEBUG
  printf("++> set_add(%d)\n", val);
  IO_FLUSH;
# endif

  if (!td) {
    i = HASH(val);
    first = b = set->buckets[i];
    result = 1;
    while (b != NULL) {
      if (b->val == val) {
        result = 0;
        break;
      }
      b = b->next;
    }
    if (result) {
      set->buckets[i] = new_entry(val, first, 0);
    }
  } else {
    TM_START(0, RW);
    i = HASH(val);
    first = b = (bucket_t *)TM_LOAD(&set->buckets[i]);
    result = 1;
    while (b != NULL) {
      if (TM_LOAD(&b->val) == val) {
        result = 0;
        break;
      }
      b = (bucket_t *)TM_LOAD(&b->next);
    }
    if (result) {
      TM_STORE(&set->buckets[i], new_entry(val, first, 1));
    }
    TM_COMMIT;
  }

  return result;
}
void AuthTokenTable::AddAuthenticationToken(const hw_auth_token_t* auth_token) {
    Entry new_entry(auth_token, clock_function_());
    RemoveEntriesSupersededBy(new_entry);
    if (entries_.size() >= max_entries_) {
        LOG_W("Auth token table filled up; replacing oldest entry", 0);
        *min_element(entries_) = std::move(new_entry);
    } else {
        entries_.push_back(std::move(new_entry));
    }
}
SymbolPropertyEntry* SymbolPropertyTable::add_entry(int index, unsigned int hash,
                                                    Symbol* sym, intptr_t sym_mode) {
  assert_locked_or_safepoint(SystemDictionary_lock);
  assert(index == index_for(sym, sym_mode), "incorrect index?");
  assert(find_entry(index, hash, sym, sym_mode) == NULL, "no double entry");

  SymbolPropertyEntry* p = new_entry(hash, sym, sym_mode);
  Hashtable<Symbol*, mtSymbol>::add_entry(index, p);
  return p;
}
Exemplo n.º 25
0
Arquivo: cache.c Projeto: liu-chong/sn
void cache_insert (int desc, void *object)
{
   register struct entry *ep;

   ep = new_entry(desc);
   ep->object = object;
   ep->next = table[desc].entries;
   if (table[desc].entries)
      table[desc].entries->prev = ep;
   table[desc].entries = ep;
}
Exemplo n.º 26
0
    symtab::entry *symbol_table::insert(conjunctive_statement *context, symtab::symbol name) throw() {

        symtab::entry *new_entry(nullptr);
        assert(nullptr != context);
        assert(!context->bound_names.find(name, new_entry));

        new_entry = entry_alloc.allocate();
        context->bound_names.force_insert(name, new_entry);

        return new_entry;
    }
Exemplo n.º 27
0
// Placeholder objects represent classes currently being loaded.
// All threads examining the placeholder table must hold the
// SystemDictionary_lock, so we don't need special precautions
// on store ordering here.
void PlaceholderTable::add_entry(int index, unsigned int hash,
                                 Symbol* class_name, ClassLoaderData* loader_data,
                                 bool havesupername, Symbol* supername){
  assert_locked_or_safepoint(SystemDictionary_lock);
  assert(class_name != NULL, "adding NULL obj");

  // Both readers and writers are locked so it's safe to just
  // create the placeholder and insert it in the list without a membar.
  PlaceholderEntry* entry = new_entry(hash, class_name, loader_data, havesupername, supername);
  add_entry(index, entry);
}
Exemplo n.º 28
0
void DialogueSupervisor::AddSpriteReference(uint32 dialogue_id, uint32 sprite_id) {
	map<uint32, vector<uint32> >::iterator entry = _sprite_references.find(dialogue_id);

	if (entry == _sprite_references.end()) {
		vector<uint32> new_entry(1, sprite_id);
		_sprite_references.insert(make_pair(dialogue_id, new_entry));
	}
	else {
		entry->second.push_back(sprite_id);
	}
}
Exemplo n.º 29
0
// Placeholder objects represent classes currently being loaded.
// All threads examining the placeholder table must hold the
// SystemDictionary_lock, so we don't need special precautions
// on store ordering here.
void PlaceholderTable::add_entry(int index, unsigned int hash,
                                 symbolHandle class_name, Handle class_loader,
                                 bool havesupername, symbolHandle supername){
  assert_locked_or_safepoint(SystemDictionary_lock);
  assert(!class_name.is_null(), "adding NULL obj");

  // Both readers and writers are locked so it's safe to just
  // create the placeholder and insert it in the list without a membar.
  PlaceholderEntry* entry = new_entry(hash, class_name(), class_loader(), havesupername, supername());
  add_entry(index, entry);
}
Exemplo n.º 30
0
int 
infra_rtt_update(struct infra_cache* infra, struct sockaddr_storage* addr,
	socklen_t addrlen, uint8_t* nm, size_t nmlen, int qtype,
	int roundtrip, int orig_rtt, time_t timenow)
{
	struct lruhash_entry* e = infra_lookup_nottl(infra, addr, addrlen,
		nm, nmlen, 1);
	struct infra_data* data;
	int needtoinsert = 0;
	int rto = 1;
	if(!e) {
		if(!(e = new_entry(infra, addr, addrlen, nm, nmlen, timenow)))
			return 0;
		needtoinsert = 1;
	} else if(((struct infra_data*)e->data)->ttl < timenow) {
		data_entry_init(infra, e, timenow);
	}
	/* have an entry, update the rtt */
	data = (struct infra_data*)e->data;
	if(roundtrip == -1) {
		rtt_lost(&data->rtt, orig_rtt);
		if(qtype == LDNS_RR_TYPE_A) {
			if(data->timeout_A < TIMEOUT_COUNT_MAX)
				data->timeout_A++;
		} else if(qtype == LDNS_RR_TYPE_AAAA) {
			if(data->timeout_AAAA < TIMEOUT_COUNT_MAX)
				data->timeout_AAAA++;
		} else {
			if(data->timeout_other < TIMEOUT_COUNT_MAX)
				data->timeout_other++;
		}
	} else {
		/* if we got a reply, but the old timeout was above server
		 * selection height, delete the timeout so the server is
		 * fully available again */
		if(rtt_unclamped(&data->rtt) >= USEFUL_SERVER_TOP_TIMEOUT)
			rtt_init(&data->rtt);
		rtt_update(&data->rtt, roundtrip);
		data->probedelay = 0;
		if(qtype == LDNS_RR_TYPE_A)
			data->timeout_A = 0;
		else if(qtype == LDNS_RR_TYPE_AAAA)
			data->timeout_AAAA = 0;
		else	data->timeout_other = 0;
	}
	if(data->rtt.rto > 0)
		rto = data->rtt.rto;

	if(needtoinsert)
		slabhash_insert(infra->hosts, e->hash, e, e->data, NULL);
	else 	{ lock_rw_unlock(&e->lock); }
	return rto;
}