Lines Matching refs:alr
114 asyncLineReader_init(AsyncLineReader* alr, in asyncLineReader_init() argument
119 alr->buffer = buffer; in asyncLineReader_init()
120 alr->buffsize = buffsize; in asyncLineReader_init()
121 alr->pos = 0; in asyncLineReader_init()
122 alr->io = io; in asyncLineReader_init()
123 alr->eol = '\n'; in asyncLineReader_init()
129 asyncLineReader_read(AsyncLineReader* alr) in asyncLineReader_read() argument
133 if (alr->pos >= alr->buffsize) { in asyncLineReader_read()
140 ret = socket_recv(alr->io->fd, &ch, 1); in asyncLineReader_read()
150 loopIo_wantRead(alr->io); in asyncLineReader_read()
155 alr->buffer[alr->pos++] = (uint8_t)ch; in asyncLineReader_read()
156 if (ch == alr->eol) { in asyncLineReader_read()
157 loopIo_dontWantRead(alr->io); in asyncLineReader_read()
160 } while (alr->pos < alr->buffsize); in asyncLineReader_read()
163 loopIo_dontWantRead(alr->io); in asyncLineReader_read()
169 asyncLineReader_getLineRaw(AsyncLineReader* alr, int *pLength) in asyncLineReader_getLineRaw() argument
171 if (alr->pos == 0 || alr->pos > alr->buffsize) in asyncLineReader_getLineRaw()
175 *pLength = alr->pos; in asyncLineReader_getLineRaw()
177 return (const char*) alr->buffer; in asyncLineReader_getLineRaw()
181 asyncLineReader_getLine(AsyncLineReader* alr) in asyncLineReader_getLine() argument
184 size_t pos = alr->pos; in asyncLineReader_getLine()
185 char* buffer = (char*) alr->buffer; in asyncLineReader_getLine()
187 if (pos == 0 || pos > alr->buffsize) in asyncLineReader_getLine()
193 if (alr->eol == '\n') { in asyncLineReader_getLine()