Home | History | Annotate | Download | only in libctf

Lines Matching defs:atom

107 /* Remove all refs to a given atom.  */
109 ctf_str_purge_atom_refs (ctf_str_atom_t *atom)
114 for (ref = ctf_list_next (&atom->csa_refs); ref != NULL; ref = next)
117 ctf_list_delete (&atom->csa_refs, ref);
121 for (movref = ctf_list_next (&atom->csa_movable_refs);
125 ctf_list_delete (&atom->csa_movable_refs, movref);
133 /* Free an atom. */
137 ctf_str_atom_t *atom = a;
139 ctf_str_purge_atom_refs (atom);
141 if (atom->csa_flags & CTF_STR_ATOM_FREEABLE)
142 free (atom->csa_str);
144 free (atom);
147 /* Create the atoms table. There is always at least one atom in it, the null
189 ctf_str_atom_t *atom;
194 atom = ctf_str_add_ref_internal (fp, &fp->ctf_str[CTF_STRTAB_0].cts_strs[i],
197 if (!atom)
200 atom->csa_offset = i;
240 aref_create (ctf_dict_t *fp, ctf_str_atom_t *atom, uint32_t *ref, int flags)
271 ctf_list_append (&atom->csa_movable_refs, movref);
274 ctf_list_append (&atom->csa_refs, aref);
280 necessary. Return the atom added. Return NULL only when out of memory
293 ctf_str_atom_t *atom = NULL;
296 atom = ctf_dynhash_lookup (fp->ctf_str_atoms, str);
302 if (atom)
305 atom->csa_offset))
309 if (atom->csa_external_offset)
310 *ref = atom->csa_external_offset;
312 *ref = atom->csa_offset;
314 return atom;
319 if (!aref_create (fp, atom, ref, flags))
326 return atom;
329 /* New atom. */
331 if ((atom = malloc (sizeof (struct ctf_str_atom))) == NULL)
333 memset (atom, 0, sizeof (struct ctf_str_atom));
343 atom->csa_flags |= CTF_STR_ATOM_FREEABLE;
344 atom->csa_str = newstr;
347 atom->csa_str = (char *) str;
349 if (ctf_dynhash_insert (fp->ctf_str_atoms, atom->csa_str, atom) < 0)
353 atom->csa_snapshot_id = fp->ctf_snapshots;
360 atom->csa_offset = fp->ctf_str_prov_offset;
363 atom->csa_offset, (void *) atom->csa_str) < 0)
366 fp->ctf_str_prov_offset += strlen (atom->csa_str) + 1;
370 if (!aref_create (fp, atom, ref, flags))
375 return atom;
379 ctf_dynhash_remove (fp->ctf_str_atoms, atom->csa_str);
380 free (atom);
394 ctf_str_atom_t *atom;
399 atom = ctf_str_add_ref_internal (fp, str, CTF_STR_PROVISIONAL, 0);
400 if (!atom)
403 return atom->csa_offset;
406 /* Like ctf_str_add(), but additionally augment the atom's refs list with the
412 ctf_str_atom_t *atom;
417 atom = ctf_str_add_ref_internal (fp, str, CTF_STR_ADD_REF
419 if (!atom)
422 return atom->csa_offset;
429 ctf_str_atom_t *atom;
434 atom = ctf_str_add_ref_internal (fp, str, CTF_STR_ADD_REF
437 if (!atom)
440 return atom->csa_offset;
448 ctf_str_atom_t *atom;
453 atom = ctf_str_add_ref_internal (fp, str, 0, 0);
454 if (!atom)
457 atom->csa_external_offset = CTF_SET_STID (offset, CTF_STRTAB_1);
471 atom->csa_external_offset,
472 (void *) atom->csa_str) < 0)
524 ctf_str_atom_t *atom = NULL;
526 atom = ctf_dynhash_lookup (fp->ctf_str_atoms, str);
527 if (!atom)
530 for (aref = ctf_list_next (&atom->csa_refs); aref != NULL; aref = anext)
535 ctf_list_delete (&atom->csa_refs, aref);
540 for (amovref = ctf_list_next (&atom->csa_movable_refs);
546 ctf_list_delete (&atom->csa_movable_refs, amovref);
560 ctf_str_atom_t *atom = (ctf_str_atom_t *) value;
563 return (atom->csa_snapshot_id > id->snapshot_id)
564 && (atom->csa_external_offset == 0);
579 ctf_str_atom_t *atom = (ctf_str_atom_t *) value;
581 ctf_str_purge_atom_refs (atom);
686 ctf_str_atom_t *atom;
688 atom = ctf_dynhash_lookup (fp->ctf_str_atoms, str);
689 if (!ctf_assert (fp, atom))
692 if (atom->csa_str[0] == 0 || atom->csa_external_offset
693 || (ctf_list_empty_p (&atom->csa_refs)
694 && ctf_list_empty_p (&atom->csa_movable_refs)))
697 strtab->cts_len += strlen (atom->csa_str) + 1;
723 ctf_str_atom_t *atom;
725 atom = ctf_dynhash_lookup (fp->ctf_str_atoms, v);
726 if (!ctf_assert (fp, atom))
729 if (atom->csa_str[0] == 0 || atom->csa_external_offset
730 || (ctf_list_empty_p (&atom->csa_refs)
731 && ctf_list_empty_p (&atom->csa_movable_refs)))
734 sorttab[i++] = atom;
755 where they are in the csa_offset for the appropriate atom. No ref
774 ctf_str_atom_t *atom = (ctf_str_atom_t *) v;
777 if (ctf_list_empty_p (&atom->csa_refs) &&
778 ctf_list_empty_p (&atom->csa_movable_refs))
781 if (atom->csa_external_offset)
784 offset = atom->csa_external_offset;
787 offset = atom->csa_offset;
788 ctf_str_update_refs (atom, offset);