/*
 * call-seq:
 *  pl = Xmms::Playlist.new(xc, [name])
 * Initializes a new Xmms::Playlist using the playlist named _name_ and the
 * Xmms::Client instance _xc_. Xmms::Client#playlist(name) is a useful
 * shortcut. _name_ is is the name of the playlist and the active playlist will
 * be used if it is not specified. Raises PlaylistError if the playlist name is
 * invalid.
 */
static VALUE
c_init (int argc, VALUE *argv, VALUE self)
{
        RbPlaylist *pl = NULL;
        VALUE name, xmms = Qnil;

        Data_Get_Struct (self, RbPlaylist, pl);

        rb_scan_args (argc, argv, "11", &xmms, &name);

        /* FIXME: Check type! */
        pl->xmms = xmms;

        if (NIL_P (name))
                pl->name_value = rb_str_new2 (XMMS_ACTIVE_PLAYLIST);
        else
                pl->name_value = rb_str_dup (name);

        OBJ_FREEZE (pl->name_value);

        pl->name = StringValuePtr (pl->name_value);

        return self;
}