Commit c8cafc8e authored by Ondrej Zajicek (work)'s avatar Ondrej Zajicek (work)
Browse files

Minor code cleanups

parent 920a86e8
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -85,7 +85,7 @@ int undo_available; /* Undo was not requested from last reconfiguration */
 * further use. Returns a pointer to the structure.
 */
struct config *
config_alloc(byte *name)
config_alloc(const byte *name)
{
  pool *p = rp_new(&root_pool, "Config");
  linpool *l = lp_new(p, 4080);
@@ -530,7 +530,7 @@ cf_error(char *msg, ...)
 * and we want to preserve it for further use.
 */
char *
cfg_strdup(char *c)
cfg_strdup(const char *c)
{
  int l = strlen(c) + 1;
  char *z = cfg_allocu(l);
+3 −3
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ struct config {
  list protos;				/* Configured protocol instances (struct proto_config) */
  list tables;				/* Configured routing tables (struct rtable_config) */
  list roa_tables;			/* Configured ROA tables (struct roa_table_config) */
  list logfiles;			/* Configured log fils (sysdep) */
  list logfiles;			/* Configured log files (sysdep) */

  int mrtdump_file;			/* Configured MRTDump file (sysdep, fd in unix) */
  char *syslog_name;			/* Name used for syslog (NULL -> no syslog) */
@@ -61,7 +61,7 @@ struct config {
extern struct config *config;		/* Currently active configuration */
extern struct config *new_config;	/* Configuration being parsed */

struct config *config_alloc(byte *name);
struct config *config_alloc(const byte *name);
int config_parse(struct config *);
int cli_parse(struct config *);
void config_free(struct config *);
@@ -95,7 +95,7 @@ extern linpool *cfg_mem;
#define cfg_alloc(size) lp_alloc(cfg_mem, size)
#define cfg_allocu(size) lp_allocu(cfg_mem, size)
#define cfg_allocz(size) lp_allocz(cfg_mem, size)
char *cfg_strdup(char *c);
char *cfg_strdup(const char *c);
void cfg_copy_list(list *dest, list *src, unsigned node_size);

/* Lexer */
+3 −3
Original line number Diff line number Diff line
@@ -63,7 +63,7 @@ tree_compare(const void *p1, const void *p2)
 * build_tree
 * @from: degenerated tree (linked by @tree->left) to be transformed into form suitable for find_tree()
 *
 * Transforms denerated tree into balanced tree.
 * Transforms degenerated tree into balanced tree.
 */
struct f_tree *
build_tree(struct f_tree *from)
+15 −1
Original line number Diff line number Diff line
/*
 *	BIRD Library -- Generic Buffer Structure
 *
 *	(c) 2013 Ondrej Zajicek <santiago@crfreenet.org>
 *	(c) 2013 CZ.NIC z.s.p.o.
 *
 *	Can be freely distributed and used under the terms of the GNU GPL.
 */

#ifndef _BIRD_BUFFER_H_
#define _BIRD_BUFFER_H_

#include "lib/resource.h"
#include "sysdep/config.h"

#define BUFFER(type)		struct { type *data; uint used, size; }

@@ -32,4 +46,4 @@

#define BUFFER_FLUSH(v)		({ (v).used = 0; })

#endif /* _BIRD_BUFFER_H_ */
+12 −1
Original line number Diff line number Diff line

/*
 *	BIRD Library -- Generic Hash Table
 *
 *	(c) 2013 Ondrej Zajicek <santiago@crfreenet.org>
 *	(c) 2013 CZ.NIC z.s.p.o.
 *
 *	Can be freely distributed and used under the terms of the GNU GPL.
 */

#ifndef _BIRD_HASH_H_
#define _BIRD_HASH_H_

#define HASH(type)		struct { type **data; uint count, order; }
#define HASH_TYPE(v)		typeof(** (v).data)
@@ -178,3 +188,4 @@

#define HASH_WALK_FILTER_END } while (0)

#endif
Loading