Re: [Vala] [Genie] array slices



Hi,
                       في س، 22-05-2010 عند 21:58 -0400 ، كتب Arc Riley:
This is the method I'm trying to modify:

    def inline send (output : array of char)
      sent : size_t
      if self.buff.str.length == 0     // write buffer is empty
        self.chan.write_chars(output, out sent)
        self.chan.flush()
        if output.length != sent       // buffer what we couldn't send
          self.buff.append_len(output) // !!! need to shift this to
I believe it should be ((char*) output) + sent (maybe you need to cast
it back to a string), and pass (output.length - sent) as second
argument.
          self.chan.add_watch(IOCondition.OUT, self.write)
      else
        self.buff.append_len(output)

It appears that I want to transfer ownership of "output" and make
output a pointer.  Is there a way to do that?

I don't understand why would you want to transfer ownership? With a
pointer, you're responsible for your memory and Vala won't track any
ownership.
In this case, for example, we didn't allocate anything, so we don't need
to free it either.

HTH,
Abderrahim




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]