~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to libdrizzle/vio.c

  • Committer: Monty Taylor
  • Date: 2008-11-07 00:24:33 UTC
  • mfrom: (575.2.2 devel)
  • mto: This revision was merged to the branch mainline in revision 579.
  • Revision ID: monty@inaugust.com-20081107002433-vj1371j0ko3i194x
MergedĀ fromĀ devel.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
  the file descriptior.
21
21
*/
22
22
 
23
 
#include "vio_priv.h"
 
23
#define DONT_MAP_VIO
 
24
#include <drizzled/global.h>
 
25
#include <libdrizzle/vio.h>
 
26
#include <string.h>
 
27
#include <stdint.h>
24
28
 
25
29
/*
26
30
 * Helper to fill most of the Vio* with defaults.
36
40
  vio->type     = type;
37
41
  vio->sd       = sd;
38
42
  if ((flags & VIO_BUFFERED_READ) &&
39
 
      !(vio->read_buffer= (char*)my_malloc(VIO_READ_BUFFER_SIZE, MYF(MY_WME))))
 
43
      !(vio->read_buffer= (char*)malloc(VIO_READ_BUFFER_SIZE)))
40
44
    flags&= ~VIO_BUFFERED_READ;
41
45
  {
42
46
    vio->viodelete      =vio_delete;
70
74
 
71
75
Vio *vio_new(int sd, enum enum_vio_type type, uint32_t flags)
72
76
{
73
 
  Vio *vio;
 
77
  Vio *vio = (Vio*) malloc(sizeof(Vio));
74
78
 
75
 
  if ((vio = (Vio*) my_malloc(sizeof(*vio),MYF(MY_WME))))
 
79
  if (vio != NULL)
76
80
  {
77
81
    vio_init(vio, type, sd, flags);
78
82
    sprintf(vio->desc, "TCP/IP (%d)", vio->sd);