/*
 * call-seq:
 * mod.mod_vals  => Array of String
 *
 * Return the values associated with the Mod object.
 */
VALUE
rb_ldap_mod_vals (VALUE self)
{
  RB_LDAPMOD_DATA *moddata;
  struct berval **bvals;
  char **svals;
  int i;
  VALUE val;

  GET_LDAPMOD_DATA (self, moddata);

  if (moddata->mod->mod_op & LDAP_MOD_BVALUES)
    {
      bvals = moddata->mod->mod_vals.modv_bvals;
      val = rb_ary_new ();
      for (i = 0; bvals[i] != NULL; i++)
        {
          VALUE str;
          str = rb_tainted_str_new (bvals[i]->bv_val, bvals[i]->bv_len);
          rb_ary_push (val, str);
        }
    }
  else
    {
      svals = moddata->mod->mod_vals.modv_strvals;
      val = rb_ary_new ();
      for (i = 0; svals[i] != NULL; i++)
        {
          VALUE str;
          str = rb_tainted_str_new2 (svals[i]);
          rb_ary_push (val, str);
        }
    }

  return val;
}