Hi, Jörg Pommnitz wrote: > > I'm not sure I completely understand you. What I'd like > to allow would be something like this: > > Octstr *foo; > Octstr *bar; > > if (condition (bar)) { > foo = do_something_with (bar); /* foo points to a new Octstr, refcount = > 1 */ > } else { > foo = octstr_get_ref (bar); /* foo becomes a new reference to the > Octstr > pointed to by bar; refcount = 2 */ > } > > do_something_else (foo); > > octstr_destroy (foo); /* refcount gets decremented. if it > reaches zero, > the Octstr actually gets released */
Huh. What did you mean with "unneeded octstr_duplicate calls" ? Aarno