Re: Token stream question

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

 



On Sat, Jun 17, 2017 at 10:55:30AM +0100, Dibyendu Majumdar wrote:
> Hi,
> 
> I am trying to understand how streams are setup, so that I can setup a
> "dummy" stream when handling input that is in a buffer rather than a
> file. I notice that tokenize_buffer() always sets up a stream with idx
> = 0. Does this mean that sparse expects tokenize_buffer() to be only
> used once in the initialize() phase?

Currently it's the only user but ...
 
> The way I am trying to set this up is as follows. I want to allow the
> user to provide inputs as files, memory buffer, or a combination. I am
> trying to process the files first, followed by the memory buffer.
> Therefore I need to use tokenize_buffer() again when processing the
> memory buffer - but presumably this ought to get a new stream idx
> rather than 0?

I think you should quickly be able to set something with:
	fd = -1;
	idx = init_stream(name, fd, NULL);
	tok = setup_stream(&stream, idx, fd, buffer, size)
	... = tokenize_stream(&stream);


-- Luc
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux