llconf  0.0.2
Functions
lines.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "lines.h"

Functions

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

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.