Monthly Archives: August 2009

Smart pointers…

Can someone explain me the following behaviour:
I have the following smart pointer:

class AlsaHwParams
    AlsaHwParams() : m_params(0)
    { snd_pcm_hw_params_alloca (&m_params); }
    { if (m_params != 0) snd_pcm_hw_params_free (m_params); }
    operator snd_pcm_hw_params_t*() { return m_params; }
    snd_pcm_hw_params_t *m_params;

Thing is: It doesn’t work. Alsa behaves very strange if I use it. Even if I make the m_params member public and access it directly. The only way it works is to not allocate from inside the class but outside like

snd_pcm_hw_params_alloca (&(hwparams.m_params));

Update: Seems replacing _alloca with _malloc fixes it.
Update: Duh, that is because alloca allocates on stack and not on heap.

The new automake meme

Apparently a small meme has spread in the gnome community, the non-recursive automake meme.
Well, rewriting the makefiles for rygel to use the new Vala support in automake-1.11 I also converted it to be non-recursive.
This is what I got:

  • Parallel builds working (but this seems to be more the work of the Vala support)
  • Cleaner Makefiles, less code duplication
  • No possibility to call “make install” for a single plugin only
  • No to very minor speed gain

All in all, this seems less improvement than expected, but the cleanliness of the is worth the minor inconveniences generated by that, though it still needs some more cleanup and flags unification.