int ci_putblk(struct channel *chn, const char *str, int len);
struct buffer *ci_swpbuf(struct channel *chn, struct buffer *buf);
int ci_putchr(struct channel *chn, char c);
-int ci_getline_nc(struct channel *chn, char **blk1, int *len1, char **blk2, int *len2);
-int ci_getblk_nc(struct channel *chn, char **blk1, int *len1, char **blk2, int *len2);
+int ci_getline_nc(const struct channel *chn, char **blk1, int *len1, char **blk2, int *len2);
+int ci_getblk_nc(const struct channel *chn, char **blk1, int *len1, char **blk2, int *len2);
int co_inject(struct channel *chn, const char *msg, int len);
-int co_getline(struct channel *chn, char *str, int len);
-int co_getblk(struct channel *chn, char *blk, int len, int offset);
-int co_getline_nc(struct channel *chn, char **blk1, int *len1, char **blk2, int *len2);
-int co_getblk_nc(struct channel *chn, char **blk1, int *len1, char **blk2, int *len2);
+int co_getline(const struct channel *chn, char *str, int len);
+int co_getblk(const struct channel *chn, char *blk, int len, int offset);
+int co_getline_nc(const struct channel *chn, char **blk1, int *len1, char **blk2, int *len2);
+int co_getblk_nc(const struct channel *chn, char **blk1, int *len1, char **blk2, int *len2);
/* returns a pointer to the stream the channel belongs to */
* jump-less and much more efficient on both 32 and 64-bit than
* the boolean test.
*/
-static inline unsigned int channel_is_empty(struct channel *c)
+static inline unsigned int channel_is_empty(const struct channel *c)
{
return !(c->buf->o | (long)c->pipe);
}
* output are full. If either of them is full, the string may be returned
* as is, without the '\n'.
*/
-int co_getline(struct channel *chn, char *str, int len)
+int co_getline(const struct channel *chn, char *str, int len)
{
int ret, max;
char *p;
* The channel status is not changed. The caller must call co_skip() to
* update it.
*/
-int co_getblk(struct channel *chn, char *blk, int len, int offset)
+int co_getblk(const struct channel *chn, char *blk, int len, int offset)
{
if (chn->flags & CF_SHUTW)
return -1;
* The channel status is not changed. The caller must call co_skip() to
* update it. Unused buffers are left in an undefined state.
*/
-int co_getblk_nc(struct channel *chn, char **blk1, int *len1, char **blk2, int *len2)
+int co_getblk_nc(const struct channel *chn, char **blk1, int *len1, char **blk2, int *len2)
{
if (unlikely(chn->buf->o == 0)) {
if (chn->flags & CF_SHUTW)
* full. If either of them is full, the string may be returned as is, without
* the '\n'. Unused buffers are left in an undefined state.
*/
-int co_getline_nc(struct channel *chn,
+int co_getline_nc(const struct channel *chn,
char **blk1, int *len1,
char **blk2, int *len2)
{
* =0 : not enough data available.
* <0 : no more bytes readable because input is shut.
*/
-int ci_getblk_nc(struct channel *chn,
+int ci_getblk_nc(const struct channel *chn,
char **blk1, int *len1,
char **blk2, int *len2)
{
* full. If either of them is full, the string may be returned as is, without
* the '\n'. Unused buffers are left in an undefined state.
*/
-int ci_getline_nc(struct channel *chn,
+int ci_getline_nc(const struct channel *chn,
char **blk1, int *len1,
char **blk2, int *len2)
{