Beispiel #1
0
  def getAllKeys(self):
    res_p = KeyVal_C_API.new_char_ptr_ptr_ptr()
    errcode = KeyVal_C_API.KeyVal_getAllKeys(res_p, self.kv)
    if errcode:
      raise Exception("[ERROR] KeyVal.getAllKeys")
    # convert from C/swig array to python array:
    res = []
    idx = 0
    res_p_p = KeyVal_C_API.char_ptr_ptr_ptr_value(res_p)
    str = KeyVal_C_API.char_ptr_arr_getitem(res_p_p, idx)
    while str:
      res.append(str)
      idx += 1
      str = KeyVal_C_API.char_ptr_arr_getitem(res_p_p, idx)

    # free up local pointer memory:
    KeyVal_C_API.delete_char_ptr_ptr_ptr(res_p)
    # free up the C's returned value:
    KeyVal_C_API.KeyVal_dtltyjr()
    return res