~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/function/math/int_divide.cc

  • Committer: Toru Maesaka
  • Date: 2009-05-18 06:07:03 UTC
  • mto: (1054.2.5 mordred)
  • mto: This revision was merged to the branch mainline in revision 1056.
  • Revision ID: dev@torum.net-20090518060703-5d2f2luyqaho10yq
Add memory allocation check and fix SEGV problem caused in statement_cleanup() by using calloc. This is temporary, the query statement list should be migrated to a proper container like std::vector

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
#include "config.h"
21
 
 
 
20
#include <drizzled/server_includes.h>
 
21
#include CSTDINT_H
22
22
#include <drizzled/function/math/int_divide.h>
23
23
 
24
 
namespace drizzled
25
 
{
26
 
 
27
24
/* Integer division */
28
25
int64_t Item_func_int_div::val_int()
29
26
{
38
35
    return 0;
39
36
  }
40
37
  return (unsigned_flag ?
41
 
          (int64_t)((uint64_t) value / (uint64_t) val2) :
 
38
          (uint64_t) value / (uint64_t) val2 :
42
39
          value / val2);
43
40
}
44
41
 
53
50
  unsigned_flag=args[0]->unsigned_flag | args[1]->unsigned_flag;
54
51
}
55
52
 
56
 
} /* namespace drizzled */