GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: usr.bin/lex/tables_shared.c Lines: 0 6 0.0 %
Date: 2017-11-07 Branches: 0 4 0.0 %

Line Branch Exec Source
1
/* $OpenBSD: tables_shared.c,v 1.1 2015/11/19 19:43:40 tedu Exp $ */
2
3
#ifdef FLEX_SCANNER
4
/*
5
dnl   tables_shared.c - tables serialization code
6
dnl
7
dnl   Copyright (c) 1990 The Regents of the University of California.
8
dnl   All rights reserved.
9
dnl
10
dnl   This code is derived from software contributed to Berkeley by
11
dnl   Vern Paxson.
12
dnl
13
dnl   The United States Government has rights in this work pursuant
14
dnl   to contract no. DE-AC03-76SF00098 between the United States
15
dnl   Department of Energy and the University of California.
16
dnl
17
dnl   This file is part of flex.
18
dnl
19
dnl   Redistribution and use in source and binary forms, with or without
20
dnl   modification, are permitted provided that the following conditions
21
dnl   are met:
22
dnl
23
dnl   1. Redistributions of source code must retain the above copyright
24
dnl      notice, this list of conditions and the following disclaimer.
25
dnl   2. Redistributions in binary form must reproduce the above copyright
26
dnl      notice, this list of conditions and the following disclaimer in the
27
dnl      documentation and/or other materials provided with the distribution.
28
dnl
29
dnl   Neither the name of the University nor the names of its contributors
30
dnl   may be used to endorse or promote products derived from this software
31
dnl   without specific prior written permission.
32
dnl
33
dnl   THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
34
dnl   IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
35
dnl   WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
36
dnl   PURPOSE.
37
dnl
38
*/
39
40
/* This file is meant to be included in both the skeleton and the actual
41
 * flex code (hence the name "_shared").
42
 */
43
#ifndef yyskel_static
44
#define yyskel_static static
45
#endif
46
#else
47
#include "flexdef.h"
48
#include "tables.h"
49
#ifndef yyskel_static
50
#define yyskel_static
51
#endif
52
#endif
53
54
55
/** Get the number of integers in this table. This is NOT the
56
 *  same thing as the number of elements.
57
 *  @param td the table
58
 *  @return the number of integers in the table
59
 */
60
yyskel_static flex_int32_t yytbl_calc_total_len (const struct yytbl_data *tbl)
61
{
62
	flex_int32_t n;
63
64
	/* total number of ints */
65
	n = tbl->td_lolen;
66
	if (tbl->td_hilen > 0)
67
		n *= tbl->td_hilen;
68
69
	if (tbl->td_id == YYTD_ID_TRANSITION)
70
		n *= 2;
71
	return n;
72
}