llconf 0.0.2
lines.h File Reference

Handling for collections of lines of text. More...

Data Structures

struct  confline
 A linked list representing the lines of text from a configuration file. More...
 

Macros

#define MAX_CONFLINE   1024
 The maximum length of the text content of a confline node.
 

Functions

struct conflinecreate_confline (const char *line)
 Create a confline representing the given line of text.
 
void destroy_confline (struct confline *cl)
 Destroy a confline and its copy of the contained text.
 
void destroy_confline_list (struct confline *cl_list)
 Destroy a list of confline nodes.
 
struct conflineread_conflines (FILE *fptr)
 Read the contents of a stream into a confline list.
 
struct conflineappend_confline (struct confline *cl_list, struct confline *cl)
 Append a confline to an existing confline list.
 

Detailed Description

Handling for collections of lines of text.

The confline structure provides for storage of a list of lines of text.

Macro Definition Documentation

◆ MAX_CONFLINE

#define MAX_CONFLINE   1024

The maximum length of the text content of a confline node.

Function Documentation

◆ append_confline()

struct confline * append_confline ( struct confline * cl_list,
struct confline * cl )

Append a confline to an existing confline list.

Parameters
[in]cl_listThe existing list to which the given line is to be appended. May be NULL if creating a new list.
[in]clThe confline to append.
Returns
The new head of the confline list. This will be the same as cl_list unless cl_list is NULL, in which case cl becomes the head of a new list.

◆ create_confline()

struct confline * create_confline ( const char * line)

Create a confline representing the given line of text.

Parameters
[in]lineThe line of text.
Returns
A new confline containing a copy of the given text.

◆ destroy_confline()

void destroy_confline ( struct confline * cl)

Destroy a confline and its copy of the contained text.

Parameters
[in]clThe confline to free.

◆ destroy_confline_list()

void destroy_confline_list ( struct confline * cl_list)

Destroy a list of confline nodes.

destroy_confline will be called on each node in the list.

Parameters
[in]cl_listThe head of the list of confline entries to free.

◆ read_conflines()

struct confline * read_conflines ( FILE * fptr)

Read the contents of a stream into a confline list.

Parameters
[in]fptrThe stream to read.
Returns
The head of the confline list representing all of the lines of the file.