Changeset 1929 in kBuild
- Timestamp:
- Oct 24, 2008 6:17:28 AM (16 years ago)
- Location:
- trunk/src/kmk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/expand.c
r1928 r1929 1008 1008 variable_buffer = 0; 1009 1009 1010 assert ( v->length == strlen (v->name));1010 assert ((unsigned int)v->length == strlen (v->name)); 1011 1011 val = variable_append (v->name, strlen (v->name), current_variable_set_list); 1012 1012 variable_buffer_output (val, "", 1); -
trunk/src/kmk/read.c
r1911 r1929 86 86 2=already interpreted */ 87 87 char *seen_else; /* Have we already seen an `else'? */ 88 #ifdef KMK 89 char ignoring_first[8]; 90 char seen_else_first[8]; 91 #endif 88 92 }; 89 93 94 #ifdef KMK 95 static struct conditionals toplevel_conditionals = 96 { 97 0, 98 sizeof (toplevel_conditionals.ignoring_first), 99 &toplevel_conditionals.ignoring_first[0], 100 &toplevel_conditionals.seen_else_first[0], 101 "", "" 102 }; 103 #else /* !KMK */ 90 104 static struct conditionals toplevel_conditionals; 105 #endif /* !KMK */ 91 106 static struct conditionals *conditionals = &toplevel_conditionals; 92 107 … … 331 346 struct conditionals *save = conditionals; 332 347 348 #ifndef KMK 333 349 memset (new, '\0', sizeof (*new)); 350 #else /* KMK */ 351 new->if_cmds = 0; 352 new->allocated = sizeof (new->ignoring_first); 353 new->ignoring = new->ignoring_first; 354 new->seen_else = new->seen_else_first; 355 #endif /* KMK */ 334 356 conditionals = new; 335 357 … … 343 365 { 344 366 /* Free any space allocated by conditional_line. */ 345 if (conditionals->ignoring) 346 free (conditionals->ignoring); 347 if (conditionals->seen_else) 348 free (conditionals->seen_else); 367 #ifdef KMK 368 if (conditionals->allocated > sizeof (conditionals->ignoring_first)) 369 #endif 370 { 371 if (conditionals->ignoring) 372 free (conditionals->ignoring); 373 if (conditionals->seen_else) 374 free (conditionals->seen_else); 375 } 349 376 350 377 /* Restore state. */ … … 1925 1952 } 1926 1953 1954 #ifndef KMK 1927 1955 if (conditionals->allocated == 0) 1928 1956 { … … 1931 1959 conditionals->seen_else = xmalloc (conditionals->allocated); 1932 1960 } 1961 #endif 1933 1962 1934 1963 o = conditionals->if_cmds++; 1935 1964 if (conditionals->if_cmds > conditionals->allocated) 1936 1965 { 1937 conditionals->allocated += 5; 1938 conditionals->ignoring = xrealloc (conditionals->ignoring, 1939 conditionals->allocated); 1940 conditionals->seen_else = xrealloc (conditionals->seen_else, 1941 conditionals->allocated); 1966 #ifdef KMK 1967 #if 0 1968 if (conditionals->allocated == 0) 1969 { 1970 conditionals->allocated = sizeof (conditionals->ignoring_first); 1971 conditionals->ignoring = conditionals->ignoring_first; 1972 conditionals->seen_else = conditionals->seen_else_first; 1973 } 1974 else 1975 #endif 1976 if (conditionals->allocated <= sizeof (conditionals->ignoring_first)) 1977 { 1978 assert (conditionals->allocated == sizeof (conditionals->ignoring_first)); 1979 conditionals->allocated += 16; 1980 conditionals->ignoring = xmalloc (conditionals->allocated); 1981 memcpy (conditionals->ignoring, conditionals->ignoring_first, 1982 sizeof (conditionals->ignoring_first)); 1983 conditionals->seen_else = xmalloc (conditionals->allocated); 1984 memcpy (conditionals->seen_else, conditionals->seen_else_first, 1985 sizeof (conditionals->seen_else_first)); 1986 } 1987 else 1988 { 1989 conditionals->allocated *= 2; 1990 #else /* !KMK */ 1991 conditionals->allocated += 5; 1992 #endif /* !KMK */ 1993 conditionals->ignoring = xrealloc (conditionals->ignoring, 1994 conditionals->allocated); 1995 conditionals->seen_else = xrealloc (conditionals->seen_else, 1996 conditionals->allocated); 1997 #ifdef KMK 1998 } 1999 #endif 1942 2000 } 1943 2001 … … 2916 2974 const char *p = *string; 2917 2975 char *new = 0; 2918 int slen ;2976 int slen = 0; 2919 2977 2920 2978 /* If the first char is a % return now. This lets us avoid extra tests
Note:
See TracChangeset
for help on using the changeset viewer.