This is part of a migration to Samba's lib/util. CTDB always passes 0
(i.e. no max_size) so use a simple assert() to enforce this, rather
than changing a lot of code that will be discarded anyway.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(Imported from commit
a4e76b58a5086e1339dea53b72437ed179e6025a)
_PUBLIC_ struct timeval timeval_current_ofs(uint32_t secs, uint32_t usecs);
double timeval_elapsed(struct timeval *tv);
double timeval_delta(struct timeval *tv2, struct timeval *tv);
-char **file_lines_load(const char *fname, int *numlines, TALLOC_CTX *mem_ctx);
+char **file_lines_load(const char *fname, int *numlines, size_t maxsize, TALLOC_CTX *mem_ctx);
char *hex_encode_talloc(TALLOC_CTX *mem_ctx, const unsigned char *buff_in, size_t len);
_PUBLIC_ int set_blocking(int fd, bool set);
not intended to remain part of ctdb
*/
+#include <assert.h>
+
#include "includes.h"
#include "system/filesys.h"
load a file into memory and return an array of pointers to lines in the file
must be freed with talloc_free().
**/
-_PUBLIC_ char **file_lines_load(const char *fname, int *numlines, TALLOC_CTX *mem_ctx)
+_PUBLIC_ char **file_lines_load(const char *fname, int *numlines, size_t maxsize, TALLOC_CTX *mem_ctx)
{
char *p;
size_t size;
+ assert(maxsize == 0);
+
p = file_load(fname, &size, mem_ctx);
if (!p) return NULL;
ctdb->nodes = NULL;
ctdb->num_nodes = 0;
- lines = file_lines_load(nlist, &nlines, ctdb);
+ lines = file_lines_load(nlist, &nlines, 0, ctdb);
if (lines == NULL) {
ctdb_set_error(ctdb, "Failed to load nlist '%s'\n", nlist);
return -1;
int nlines;
int i;
- lines = file_lines_load(ctdb->public_addresses_file, &nlines, ctdb);
+ lines = file_lines_load(ctdb->public_addresses_file, &nlines, 0, ctdb);
if (lines == NULL) {
ctdb_set_error(ctdb, "Failed to load public address list '%s'\n", ctdb->public_addresses_file);
return -1;
struct pnn_node *pnn_nodes = NULL;
struct pnn_node *pnn_node;
- lines = file_lines_load(file, &nlines, mem_ctx);
+ lines = file_lines_load(file, &nlines, 0, mem_ctx);
if (lines == NULL) {
return NULL;
}