mirror of
https://github.com/rfivet/uemacs.git
synced 2024-11-18 02:26:06 -05:00
uemacs: Add ARRAY_SIZE macro so we can get rid of some hard coded calculations.
Signed-off-by: Thiago Farina <thiago.farina@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
e32cecc843
commit
9489673a1b
7
eval.c
7
eval.c
@ -11,6 +11,7 @@
|
|||||||
#include "edef.h"
|
#include "edef.h"
|
||||||
#include "efunc.h"
|
#include "efunc.h"
|
||||||
#include "evar.h"
|
#include "evar.h"
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
void varinit(void)
|
void varinit(void)
|
||||||
{ /* initialize the user variable list */
|
{ /* initialize the user variable list */
|
||||||
@ -196,12 +197,12 @@ char *gtenv(char *vname)
|
|||||||
int vnum; /* ordinal number of var refrenced */
|
int vnum; /* ordinal number of var refrenced */
|
||||||
|
|
||||||
/* scan the list, looking for the referenced name */
|
/* scan the list, looking for the referenced name */
|
||||||
for (vnum = 0; vnum < NEVARS; vnum++)
|
for (vnum = 0; vnum < ARRAY_SIZE(envars); vnum++)
|
||||||
if (strcmp(vname, envars[vnum]) == 0)
|
if (strcmp(vname, envars[vnum]) == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* return errorm on a bad reference */
|
/* return errorm on a bad reference */
|
||||||
if (vnum == NEVARS)
|
if (vnum == ARRAY_SIZE(envars))
|
||||||
#if ENVFUNC
|
#if ENVFUNC
|
||||||
{
|
{
|
||||||
char *ename = getenv(vname);
|
char *ename = getenv(vname);
|
||||||
@ -457,7 +458,7 @@ fvar:
|
|||||||
switch (var[0]) {
|
switch (var[0]) {
|
||||||
|
|
||||||
case '$': /* check for legal enviromnent var */
|
case '$': /* check for legal enviromnent var */
|
||||||
for (vnum = 0; vnum < NEVARS; vnum++)
|
for (vnum = 0; vnum < ARRAY_SIZE(envars); vnum++)
|
||||||
if (strcmp(&var[1], envars[vnum]) == 0) {
|
if (strcmp(&var[1], envars[vnum]) == 0) {
|
||||||
vtype = TKENV;
|
vtype = TKENV;
|
||||||
break;
|
break;
|
||||||
|
2
evar.h
2
evar.h
@ -67,8 +67,6 @@ static char *envars[] = {
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#define NEVARS sizeof(envars) / sizeof(char *)
|
|
||||||
|
|
||||||
/* and its preprocesor definitions */
|
/* and its preprocesor definitions */
|
||||||
|
|
||||||
#define EVFILLCOL 0
|
#define EVFILLCOL 0
|
||||||
|
Loading…
Reference in New Issue
Block a user