use generated constant for length
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@22580 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -70,7 +70,7 @@ normalize_h.file.write(
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#define MAX_LENGTH %u
|
#define MAX_LENGTH_CANON %u
|
||||||
|
|
||||||
struct translation {
|
struct translation {
|
||||||
uint32_t key;
|
uint32_t key;
|
||||||
|
@@ -40,11 +40,10 @@
|
|||||||
#include <err.h>
|
#include <err.h>
|
||||||
|
|
||||||
#include "windlocl.h"
|
#include "windlocl.h"
|
||||||
|
#include "normalize_table.h"
|
||||||
|
|
||||||
RCSID("$Id$");
|
RCSID("$Id$");
|
||||||
|
|
||||||
#define MAX_LENGTH 20
|
|
||||||
|
|
||||||
static size_t
|
static size_t
|
||||||
parse_vector(char *buf, uint32_t *v)
|
parse_vector(char *buf, uint32_t *v)
|
||||||
{
|
{
|
||||||
@@ -56,8 +55,8 @@ parse_vector(char *buf, uint32_t *v)
|
|||||||
for(n = strtok_r(buf, " ", &last);
|
for(n = strtok_r(buf, " ", &last);
|
||||||
n != NULL;
|
n != NULL;
|
||||||
n = strtok_r(NULL, " ", &last)) {
|
n = strtok_r(NULL, " ", &last)) {
|
||||||
if (ret >= MAX_LENGTH) {
|
if (ret >= MAX_LENGTH_CANON) {
|
||||||
errx(1, "increase MAX_LENGTH");
|
errx(1, "increase MAX_LENGTH_CANON");
|
||||||
}
|
}
|
||||||
if (sscanf(n, "%x", &u) != 1) {
|
if (sscanf(n, "%x", &u) != 1) {
|
||||||
errx(1, "failed to parse hex: %s", n);
|
errx(1, "failed to parse hex: %s", n);
|
||||||
@@ -73,9 +72,9 @@ test(char *buf)
|
|||||||
{
|
{
|
||||||
char *last;
|
char *last;
|
||||||
char *c;
|
char *c;
|
||||||
uint32_t in[MAX_LENGTH];
|
uint32_t in[MAX_LENGTH_CANON];
|
||||||
size_t in_len;
|
size_t in_len;
|
||||||
uint32_t out[MAX_LENGTH];
|
uint32_t out[MAX_LENGTH_CANON];
|
||||||
size_t out_len;
|
size_t out_len;
|
||||||
uint32_t *tmp;
|
uint32_t *tmp;
|
||||||
size_t norm_len;
|
size_t norm_len;
|
||||||
@@ -100,7 +99,7 @@ test(char *buf)
|
|||||||
if (c == NULL)
|
if (c == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
norm_len = MAX_LENGTH;
|
norm_len = MAX_LENGTH_CANON;
|
||||||
tmp = malloc(norm_len * sizeof(size_t));
|
tmp = malloc(norm_len * sizeof(size_t));
|
||||||
if (tmp == NULL)
|
if (tmp == NULL)
|
||||||
err(1, "malloc");
|
err(1, "malloc");
|
||||||
|
Reference in New Issue
Block a user