[Bug 24618] [0.11] add TpStringPool, a refcounted pool of strings

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Thu Apr 15 13:37:15 CEST 2010


https://bugs.freedesktop.org/show_bug.cgi?id=24618

Cosimo Alfarano <cosimo.alfarano at collabora.co.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Status Whiteboard|review-                     |
           Keywords|patch                       |

--- Comment #3 from Cosimo Alfarano <cosimo.alfarano at collabora.co.uk> 2010-04-15 04:37:15 PDT ---
Briefly:

I'll remove the normalization in the pool it can be added later if needed with
some methods added.
the handle repo is still using the original normalize function, it hasn't been
touched.

About the "handle" term renamed, I'd use "id" (probably better in
_lookup_by_id() which is already used and more recognisable). "number" sounds
so generic.

gtk-doc fixed, I'll complete the doc, also.

not ready for the next review.

Long version:

TpDynamicHandleRepo has its implementation of the normalisation function, the
original one.
Normalisation is done ensuring and looking up using repo's
self->priv->normalize_function and set by the _new() using the object's props.

The pool's normalisation func is not used by the handle repo.

Rationale for the pool having its normalisation method:
There might be protocols, for instance, whose identifiers are not case
sensitive but the server won't send them normalized. A CM might want to store
them as they "arrive", being sure to reference "id" as the already known "Id"
instead as a new identifier.

I'll remove it for sake of simplicity if the rationale is not strong enough, it
can always be added later, though it would need more methods: _lookup()
wouldn't have the context passed, and if added later, it would be needed
_lookup_normalized() added, equivalent to the current couple
_lookup_exact()/_lookup().

About the two lookup functions, there is _lookup_exact(s) _lookup(s,ctx) and
_lookup_handle(guint) (which will renamed be _lookup_by_number/_lookup_by_id).


> and wouldn't need a function equivalent to the current 
> tp_string_pool_lookup (which involves a malloc/free cycle).

tp_string_pool_lookup() when used without a normalization function is almost
equivalent to the _exact version, beside the time spent on checking two if's
guards and stacking a g_free with a NULL ptr which would return immediately.

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.



More information about the telepathy-bugs mailing list