~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to libdrizzle-2.0/drizzle.cc

  • Committer: Brian Aker
  • Date: 2011-11-24 00:05:44 UTC
  • mto: This revision was merged to the branch mainline in revision 2465.
  • Revision ID: brian@tangent.org-20111124000544-186obn61qr3b7r9x
First pass, drizzle_create() no longer takes an argument. This means that we can now change drizzle_st without being concerned about ABI.

Show diffs side-by-side

added added

removed removed

Lines of Context:
86
86
  return _verbose_name[verbose];
87
87
}
88
88
 
89
 
drizzle_st *drizzle_create(drizzle_st *drizzle)
 
89
drizzle_st *drizzle_create()
90
90
{
91
91
#if defined(_WIN32)
92
92
  /* if it is MS windows, invoke WSAStartup */
101
101
  sigaction(SIGPIPE, &act, NULL);
102
102
#endif
103
103
 
 
104
  drizzle_st *drizzle= new (std::nothrow) drizzle_st;
 
105
 
104
106
  if (drizzle == NULL)
105
107
  {
106
 
    drizzle= new (std::nothrow) drizzle_st;
107
 
 
108
 
    if (drizzle == NULL)
109
 
    {
110
 
      return NULL;
111
 
    }
112
 
    drizzle->options.is_allocated= true;
 
108
    return NULL;
113
109
  }
 
110
  drizzle->options.is_allocated= true;
114
111
 
115
112
  /* @todo remove this default free flag with new API. */
116
113
  drizzle->options.is_free_objects= true;
140
137
  return drizzle;
141
138
}
142
139
 
143
 
drizzle_st *drizzle_clone(drizzle_st *drizzle, const drizzle_st *from)
 
140
drizzle_st *drizzle_clone(const drizzle_st *source)
144
141
{
145
 
  drizzle= drizzle_create(drizzle);
 
142
  drizzle_st *drizzle= drizzle_create();
146
143
  if (drizzle == NULL)
147
144
  {
148
145
    return NULL;
149
146
  }
150
147
 
151
148
  bool cache_state= drizzle->options.is_allocated;
152
 
  drizzle->options= from->options;
 
149
  drizzle->options= source->options;
153
150
  drizzle->options.is_allocated= cache_state;
154
151
 
155
 
  for (drizzle_con_st* con= from->con_list; con != NULL; con= con->next)
 
152
  for (drizzle_con_st* con= source->con_list; con != NULL; con= con->next)
156
153
  {
157
154
    if (drizzle_con_clone(drizzle, NULL, con) == NULL)
158
155
    {