~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to sql/gen_lex_hash.cc

  • Committer: Brian Aker
  • Date: 2008-07-07 16:58:11 UTC
  • mfrom: (77.1.25 codestyle)
  • Revision ID: brian@tangent.org-20080707165811-jfqxacc3436dut4n
Merge from Monty's tree

Show diffs side-by-side

added added

removed removed

Lines of Context:
250
250
char *hash_map= 0;
251
251
int size_hash_map= 0;
252
252
 
 
253
/* Ok. I honestly don't know why this has no problem and
 
254
 * array_elements macro doesn't. But it works.
 
255
 */
 
256
static inline uint32_t array_elements_func(SYMBOL * symbols) {
 
257
  return sizeof(symbols)/sizeof(symbols[0]);
 
258
}
 
259
 
253
260
void add_struct_to_map(hash_lex_struct *st)
254
261
{
255
262
  st->ithis= size_hash_map/4;
256
263
  size_hash_map+= 4;
257
264
  hash_map= (char*)realloc((char*)hash_map,size_hash_map);
258
265
  hash_map[size_hash_map-4]= (char) (st->first_char == -1 ? 0 :
259
 
                                     st->first_char);
 
266
                                     st->first_char);
260
267
  hash_map[size_hash_map-3]= (char) (st->first_char == -1 ||
261
 
                                     st->first_char == 0 ? 0 : st->last_char);
 
268
                                     st->first_char == 0 ? 0 : st->last_char);
262
269
  if (st->first_char == -1)
263
270
  {
264
271
    hash_map[size_hash_map-2]= ((unsigned int)(int16)st->iresult)&255;
266
273
  }
267
274
  else if (st->first_char == 0)
268
275
  {
269
 
    hash_map[size_hash_map-2]= ((unsigned int)(int16)array_elements(symbols))&255;
 
276
    hash_map[size_hash_map-2]= ((unsigned int)(int16)array_elements_func(symbols))&255;
270
277
    hash_map[size_hash_map-1]= ((unsigned int)(int16)array_elements(symbols))>>8;
271
278
  }
272
279
}