~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/logging.cc

  • Committer: Mark Atwood
  • Date: 2008-09-12 02:25:32 UTC
  • mto: This revision was merged to the branch mainline in revision 437.
  • Revision ID: mark@fallenpegasus.com-20080912022532-n4oijzfs5r2medho
changes of Brian's recommendation
  get rid of "stuff" pointer
  better handling of unused

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
 
11
11
  p= (logging_t *) malloc(sizeof(logging_t));
12
12
  if (p == NULL) return 1;
13
 
  memset(p, 0, sizeof(logging_st));
 
13
  memset(p, 0, sizeof(logging_t));
14
14
 
15
15
  plugin->data= (void *)p;
16
16
 
32
32
 
33
33
int logging_finalizer(st_plugin_int *plugin)
34
34
35
 
  logging_st *p = (logging_st *) plugin->data;
 
35
  logging_t *p = (logging_t *) plugin->data;
36
36
 
37
37
  fprintf(stderr, "MRA %s plugin:%s dl:%s\n",
38
38
          __func__, plugin->name.str, plugin->plugin_dl->dl.str);
51
51
  return 0;
52
52
}
53
53
 
54
 
bool logging_pre_do_i (THD *thd,
55
 
                       plugin_ref plugin,
56
 
                       void *stuff)
 
54
static bool logging_pre_iterate (THD *thd, plugin_ref plugin)
57
55
{
58
56
  logging_t *l= plugin_data(plugin, logging_t *);
59
57
 
60
58
  if (l && l->logging_pre)
61
59
  {
62
 
    if (l->logging_pre(thd, stuff))
 
60
    if (l->logging_pre(thd))
63
61
      return true;
64
62
  }
65
63
  return false;
66
64
}
67
65
 
68
 
void logging_pre_do (THD *thd, void *stuff)
 
66
void logging_pre_do (THD *thd)
69
67
{
70
 
  if (plugin_foreach(thd, logging_pre_do_i, DRIZZLE_LOGGER_PLUGIN, stuff))
 
68
  if (plugin_foreach(thd, logging_pre_iterate, DRIZZLE_LOGGER_PLUGIN))
71
69
  {
72
70
    sql_print_error("Logging plugin pre had an error.");
73
71
  }
74
72
  return;
75
73
}
76
74
 
77
 
bool logging_post_do_i (THD *thd,
78
 
                       plugin_ref plugin,
79
 
                       void *stuff)
 
75
static bool logging_post_iterate (THD *thd, plugin_ref plugin)
80
76
{
81
77
  logging_t *l= plugin_data(plugin, logging_t *);
82
78
 
83
79
  if (l && l->logging_post)
84
80
  {
85
 
    if (l->logging_post(thd, stuff))
 
81
    if (l->logging_post(thd))
86
82
      return true;
87
83
  }
88
84
  return false;
89
85
}
90
86
 
91
 
void logging_post_do (THD *thd, void *stuff)
 
87
void logging_post_do (THD *thd)
92
88
{
93
 
  if (plugin_foreach(thd, logging_post_do_i, DRIZZLE_LOGGER_PLUGIN, stuff))
 
89
  if (plugin_foreach(thd, logging_post_iterate, DRIZZLE_LOGGER_PLUGIN))
94
90
  {
95
91
    sql_print_error("Logging plugin post had an error.");
96
92
  }