Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add MAX_PAR_CHARS constant

  • Loading branch information...
commit b67cd3de21491d40a27cb02ac300d783ab815769 1 parent 1ea2e22
@b4winckler authored
Showing with 7 additions and 2 deletions.
  1. +7 −2 src/lxbread.c
View
9 src/lxbread.c
@@ -6,7 +6,10 @@
#include <stdbool.h>
#include "map_lib.h"
-#define MAX_PAR 99
+// Max number of parameters in LXB file that we handle
+#define MAX_PAR 99
+// Max chars needed to print MAX_PAR (must be updated when MAX_PAR is!)
+#define MAX_PAR_CHARS 2
typedef struct {
int begin_text, end_text;
@@ -61,7 +64,9 @@ char *read_file(const char *filename, long *size)
const char *parameter_key(int n, char type)
{
- static char buf[6]; // max 5 chars and null
+ // Key is of format "$PXY", where len(X) <= MAX_PAR_CHARS, and Y == type,
+ // also include room for null terminator.
+ static char buf[MAX_PAR_CHARS+4];
if (n < 0 || n >= MAX_PAR)
return "";
Please sign in to comment.
Something went wrong with that request. Please try again.