~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/errmsg.cc

  • Committer: Monty Taylor
  • Date: 2009-01-06 18:46:25 UTC
  • mto: This revision was merged to the branch mainline in revision 762.
  • Revision ID: mordred@inaugust.com-20090106184625-kqu7nsnwjwm5jv4s
Enabled dirty_close.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
{
28
28
  errmsg_t *p;
29
29
 
30
 
  p= (errmsg_t *) malloc(sizeof(errmsg_t));
 
30
  p= new errmsg_t;
31
31
  if (p == NULL) return 1;
32
32
  memset(p, 0, sizeof(errmsg_t));
33
33
 
38
38
    if (plugin->plugin->init((void *)p))
39
39
    {
40
40
      /* we're doing the errmsg plugin api,
41
 
         so we can't trust the errmsg api to emit our error messages
42
 
         so we will emit error messages to stderr */
 
41
        so we can't trust the errmsg api to emit our error messages
 
42
        so we will emit error messages to stderr */
43
43
      /* TRANSLATORS: The leading word "errmsg" is the name
44
 
         of the plugin api, and so should not be translated. */
 
44
        of the plugin api, and so should not be translated. */
45
45
      fprintf(stderr,
46
 
              _("errmsg plugin '%s' init() failed."),
47
 
              plugin->name.str);
 
46
              _("errmsg plugin '%s' init() failed."),
 
47
              plugin->name.str);
48
48
      goto err;
49
49
    }
50
50
  }
54
54
  return 0;
55
55
 
56
56
err:
57
 
  free(p);
 
57
  delete p;
58
58
  return 1;
59
59
}
60
60
 
61
61
int errmsg_finalizer(st_plugin_int *plugin)
62
 
 
62
{
63
63
  errmsg_t *p = (errmsg_t *) plugin->data;
64
64
 
65
65
  if (plugin->plugin->deinit)
77
77
    }
78
78
  }
79
79
 
80
 
  if (p) free(p);
 
80
  if (p) delete p;
81
81
 
82
82
  return 0;
83
83
}
121
121
  return false;
122
122
}
123
123
 
124
 
bool errmsg_vprintf (Session *session, int priority, const char *format, va_list ap)
 
124
bool errmsg_vprintf (Session *session, int priority, char const *format, va_list ap)
125
125
{
126
126
  bool foreach_rv;
127
127
  errmsg_parms_t parms;
145
145
 
146
146
  /* call errmsg_iterate
147
147
     once for each loaded errmsg plugin */
148
 
  foreach_rv= plugin_foreach(session,
149
 
                             errmsg_iterate,
150
 
                             DRIZZLE_ERRMSG_PLUGIN,
151
 
                             (void *) &parms);
 
148
  foreach_rv= plugin_foreach(session, errmsg_iterate,
 
149
                             DRIZZLE_ERRMSG_PLUGIN, (void *) &parms);
152
150
  return foreach_rv;
153
151
}
154
152
 
155
 
bool errmsg_printf (Session *session, int priority, const char *format, ...)
156
 
{
157
 
  bool rv;
158
 
  va_list args;
159
 
  va_start(args, format);
160
 
  rv= errmsg_vprintf(session, priority, format, args);
161
 
  va_end(args);
162
 
  return rv;
163
 
}
 
153