~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mystrings/decimal.c

  • Committer: Brian Aker
  • Date: 2008-07-31 19:57:34 UTC
  • mfrom: (236.1.27 codestyle)
  • Revision ID: brian@tangent.org-20080731195734-c7cu4gx70xgjr68o
Merge from Monty.

Show diffs side-by-side

added added

removed removed

Lines of Context:
99
99
      implementation-defined.
100
100
*/
101
101
 
 
102
#include <alloca.h>
102
103
#include <m_string.h>
103
104
#include <m_ctype.h>
104
105
#include <storage/myisam/myisampack.h>
105
 
#include <mysys/my_sys.h> /* for my_alloca */
106
106
#include <mystrings/decimal.h>
107
107
 
108
108
/*
1311
1311
  int bin_size= decimal_bin_size(precision, scale);
1312
1312
 
1313
1313
  sanity(to);
1314
 
  d_copy= (uchar*) my_alloca(bin_size);
 
1314
  d_copy= (uchar*) alloca(bin_size);
1315
1315
  memcpy(d_copy, from, bin_size);
1316
1316
  d_copy[0]^= 0x80;
1317
1317
  from= d_copy;
1394
1394
      goto err;
1395
1395
    buf++;
1396
1396
  }
1397
 
  my_afree(d_copy);
1398
1397
  return error;
1399
1398
 
1400
1399
err:
1401
 
  my_afree(d_copy);
1402
1400
  decimal_make_zero(((decimal_t*) to));
1403
1401
  return(E_DEC_BAD_NUM);
1404
1402
}
2173
2171
 
2174
2172
  len1=(i=ROUND_UP(prec1))+ROUND_UP(2*frac2+scale_incr+1) + 1;
2175
2173
  set_if_bigger(len1, 3);
2176
 
  if (!(tmp1=(dec1 *)my_alloca(len1*sizeof(dec1))))
 
2174
  if (!(tmp1=(dec1 *)alloca(len1*sizeof(dec1))))
2177
2175
    return E_DEC_OOM;
2178
2176
  memcpy(tmp1, buf1, i*sizeof(dec1));
2179
2177
  memset(tmp1+i, 0, (len1-i)*sizeof(dec1));
2320
2318
        *buf0++=*start1++;
2321
2319
  }
2322
2320
done:
2323
 
  my_afree(tmp1);
2324
2321
  return error;
2325
2322
}
2326
2323