~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/my_error.cc

  • Committer: Brian Aker
  • Date: 2009-10-16 10:27:33 UTC
  • mfrom: (1183.1.4 merge)
  • Revision ID: brian@gaz-20091016102733-b10po5oup0hjlilh
MergeĀ EngineĀ changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
   along with this program; if not, write to the Free Software
14
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
15
 
16
 
#include "mysys_priv.h"
17
 
#include <libdrizzle/gettext.h>
18
 
#include "mysys_err.h"
 
16
#include "mysys/mysys_priv.h"
 
17
#include "mysys/mysys_err.h"
19
18
#include <mystrings/m_string.h>
 
19
#include <mystrings/m_ctype.h>
 
20
#include <drizzled/gettext.h>
 
21
#include <stdio.h>
20
22
#include <stdarg.h>
21
 
#include <mystrings/m_ctype.h>
22
23
 
23
24
/* Define some external variables for error handling */
24
25
 
31
32
  my_printf_error(ER_CODE, format, MYF(N), ...)
32
33
*/
33
34
 
34
 
char errbuff[NRERRBUFFS][ERRMSGSIZE];
35
 
 
36
35
/*
37
36
  Message texts are registered into a linked list of 'my_err_head' structs.
38
37
  Each struct contains (1.) an array of pointers to C character strings with
106
105
      ...       variable list
107
106
*/
108
107
 
109
 
void my_printf_error(uint error, const char *format, myf MyFlags, ...)
 
108
void my_printf_error(uint32_t error, const char *format, myf MyFlags, ...)
110
109
{
111
110
  va_list args;
112
111
  char ebuff[ERRMSGSIZE+20];
128
127
      MyFlags   Flags
129
128
*/
130
129
 
131
 
void my_message(uint error, const char *str, register myf MyFlags)
 
130
void my_message(uint32_t error, const char *str, register myf MyFlags)
132
131
{
133
132
  (*error_handler_hook)(error, str, MyFlags);
134
133
}
162
161
  struct my_err_head **search_meh_pp;
163
162
 
164
163
  /* Allocate a new header structure. */
165
 
  if (! (meh_p= (struct my_err_head*) my_malloc(sizeof(struct my_err_head),
166
 
                                                MYF(MY_WME))))
 
164
  if (! (meh_p= (struct my_err_head*) malloc(sizeof(struct my_err_head))))
167
165
    return 1;
168
166
  meh_p->meh_errmsgs= errmsgs;
169
167
  meh_p->meh_first= first;
182
180
  /* Error numbers must be unique. No overlapping is allowed. */
183
181
  if (*search_meh_pp && ((*search_meh_pp)->meh_first <= last))
184
182
  {
185
 
    my_free((uchar*)meh_p, MYF(0));
 
183
    free((unsigned char*)meh_p);
186
184
    return 1;
187
185
  }
188
186
 
240
238
  errmsgs= meh_p->meh_errmsgs;
241
239
  bool is_globerrs= meh_p->is_globerrs;
242
240
 
243
 
  my_free((uchar*) meh_p, MYF(0));
 
241
  free((unsigned char*) meh_p);
244
242
 
245
243
  if (is_globerrs)
246
244
    return NULL;
247
 
  
 
245
 
248
246
  return errmsgs;
249
247
}
250
248
 
255
253
  for (list= my_errmsgs_globerrs.meh_next; list; list= next)
256
254
  {
257
255
    next= list->meh_next;
258
 
    my_free((uchar*) list, MYF(0));
 
256
    free((unsigned char*) list);
259
257
  }
260
258
  my_errmsgs_list= &my_errmsgs_globerrs;
261
259
}