} else {
status_buf[ret + sbo] = '\0';
sbo = for_each_line(status_buf, ret + sbo,
- &check_stat_line, 0);
+ &check_stat_line);
}
}
slot_io(&wfds);
if (cp_numread <= 0 && !cbo) /* command complete */
return 0;
if (cbo)
- cbo = for_each_line(command_buf, cbo, &add_output_line, 0);
+ cbo = for_each_line(command_buf, cbo, &add_output_line);
if (cp_numread <= 0)
cbo = 0;
wrefresh(bot.win);
if (ret > 0) {
loaded += ret;
buf[loaded] = '\0';
- loaded = for_each_line(buf, loaded, line_handler, 0);
+ loaded = for_each_line(buf, loaded, line_handler);
}
return ret;
}
void stat_client_write(char *msg);
int stat_client_add(int);
void dump_empty_status(void);
-unsigned for_each_line(char *, int, void (*)(char *), int);
+unsigned for_each_line(char *, int, void (*)(char *));
struct stat_item_data {
char *prefix, *postfix;
goto out;
}
PARA_DEBUG_LOG("loading new playlist (%d bytes)\n", pcd->size);
- ret = for_each_line((char *)shm, pcd->size, &playlist_add, 0);
+ ret = for_each_line((char *)shm, pcd->size, &playlist_add);
shm_detach(shm);
PARA_NOTICE_LOG("new playlist (%d entries)\n", playlist_len);
pcd->retval = 1;
* \param buf the buffer containing data seperated by newlines
* \param n the number of bytes in \a buf
* \param line_handler the custom function
- * \param num upper bound on calls to \a line_handler
*
* If \a line_handler is \p NULL, return number of complete lines in buf.
- * Otherwise, call \a line_handler for each complete line, but no more than \a num
- * times. If \a num is zero, there is no restriction on how often \a line_handler
- * may be called. The rest of the buffer (last chunk containing incomplete line
- * if \a num is zero) is moved to the beginning of the buffer.
+ * Otherwise, call \a line_handler for each complete line. The rest of the
+ * buffer (last chunk containing incomplete line is moved to the beginning of
+ * the buffer.
*
* \return If line_handler is not NULL, this function returns the number
* of bytes not handled to \a line_handler.
*/
-unsigned for_each_line(char *buf, int n, void (*line_handler)(char *), int num)
+unsigned for_each_line(char *buf, int n, void (*line_handler)(char *))
{
char *start = buf, *end;
int i, num_lines = 0;
*end = '\0';
line_handler(start);
start = ++end;
- if (num && num_lines >= num)
- break;
} else
start = ++end;
}