Commit 85d04cce authored by unknown's avatar unknown
Browse files

Merge bk-internal.mysql.com:/home/bk/mysql-4.1/

into serg.mylan:/usr/home/serg/Abk/mysql-4.1


myisam/myisamchk.c:
  Auto merged
parents 855e4daf 1cd249e0
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@ fi

just_print=
just_configure=
full_debug=
while test $# -gt 0
do
  case "$1" in
@@ -21,6 +22,7 @@ Any other options will be passed directly to configure.

Note:  this script is intended for internal use by MySQL developers.
EOF
  --with-debug=full ) full_debug="=full"; shift ;;
  * ) break ;;
  esac
done
@@ -48,7 +50,8 @@ fast_cflags="-O3 -fno-omit-frame-pointer"
# this is one is for someone who thinks 1% speedup is worth not being
# able to backtrace
reckless_cflags="-O3 -fomit-frame-pointer "
debug_cflags="-DUNIV_MUST_NOT_INLINE -DEXTRA_DEBUG -DFORCE_INIT_OF_VARS -DSAFEMALLOC -DPEDANTIC_SAFEMALLOC -DSAFE_MUTEX -O1 -Wuninitialized"

debug_cflags="-DUNIV_MUST_NOT_INLINE -DEXTRA_DEBUG -DFORCE_INIT_OF_VARS -DSAFEMALLOC -DPEDANTIC_SAFEMALLOC -DSAFE_MUTEX"

base_cxxflags="-felide-constructors -fno-exceptions -fno-rtti"

@@ -62,7 +65,11 @@ sparc_configs=""
# and unset local_infile_configs
local_infile_configs="--enable-local-infile"

debug_configs="--with-debug"
debug_configs="--with-debug$full_debug"
if [ -z "$full_debug" ]
then
	debug_cflags="$debug_cflags -O1 -Wuninitialized"
fi

if gmake --version > /dev/null 2>&1
then
+1 −1
Original line number Diff line number Diff line
@@ -45,5 +45,5 @@ enum options_client
  OPT_COMPATIBLE, OPT_RECONNECT, OPT_DELIMITER, OPT_SECURE_AUTH,
  OPT_OPEN_FILES_LIMIT, OPT_SET_CHARSET, OPT_CREATE_OPTIONS,
  OPT_START_POSITION, OPT_STOP_POSITION, OPT_START_DATETIME, OPT_STOP_DATETIME,
  OPT_SIGINT_IGNORE
  OPT_SIGINT_IGNORE, OPT_HEXBLOB
};
+52 −9
Original line number Diff line number Diff line
@@ -81,7 +81,8 @@ static my_bool verbose=0,tFlag=0,cFlag=0,dFlag=0,quick= 1, extended_insert= 1,
                opt_alldbs=0,opt_create_db=0,opt_first_slave=0,opt_set_charset,
		opt_autocommit=0,opt_master_data,opt_disable_keys=1,opt_xml=0,
		opt_delete_master_logs=0, tty_password=0,
		opt_single_transaction=0, opt_comments= 0, opt_compact= 0;
		opt_single_transaction=0, opt_comments= 0, opt_compact= 0,
		opt_hex_blob=0;
static ulong opt_max_allowed_packet, opt_net_buffer_length;
static MYSQL mysql_connection,*sock=0;
static char  insert_pat[12 * 1024],*opt_password=0,*current_user=0,
@@ -316,6 +317,8 @@ static struct my_option my_long_options[] =
  {"comments", 'i', "Write additional information.",
   (gptr*) &opt_comments, (gptr*) &opt_comments, 0, GET_BOOL, NO_ARG,
   1, 0, 0, 0, 0, 0},
  {"hex-blob", OPT_HEXBLOB, "Dump BLOBs in HEX. this mode does not work with extended-insert",
   (gptr*) &opt_hex_blob, (gptr*) &opt_hex_blob, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
  {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};

@@ -1507,6 +1510,7 @@ static void dumpTable(uint numFields, char *table)

      for (i = 0; i < mysql_num_fields(res); i++)
      {
        int is_blob;
	if (!(field = mysql_fetch_field(res)))
	{
	  sprintf(query,"%s: Not enough fields from table %s! Aborting.\n",
@@ -1515,6 +1519,17 @@ static void dumpTable(uint numFields, char *table)
	  error= EX_CONSCHECK;
	  goto err;
	}
	
	/*
	   63 is my_charset_bin. If charsetnr is not 63,
	   we have not a BLOB but a TEXT column. 
	   we'll dump it in hex only BLOB columns.
	*/
        is_blob= (opt_hex_blob && field->charsetnr == 63 &&
                  (field->type == FIELD_TYPE_BLOB ||
                   field->type == FIELD_TYPE_LONG_BLOB ||
                   field->type == FIELD_TYPE_MEDIUM_BLOB ||
                   field->type == FIELD_TYPE_TINY_BLOB)) ? 1 : 0;
	if (extended_insert)
	{
	  ulong length = lengths[i];
@@ -1535,13 +1550,29 @@ static void dumpTable(uint numFields, char *table)
		  error= EX_EOM;
		  goto err;
		}
                if (opt_hex_blob && is_blob)
                {
                  ulong counter;
                  unsigned char *ptr= row[i];
                  dynstr_append(&extended_row, "0x");
                  for (counter = 0; counter < lengths[i]; counter++)
                  {
                    char xx[3];
                    sprintf(xx, "%02X", ptr[counter]);
                    dynstr_append(&extended_row, xx);
                  }
                }
                else
                {
                  dynstr_append(&extended_row,"'");
                  extended_row.length +=
                  mysql_real_escape_string(&mysql_connection,
					   &extended_row.str[extended_row.length],row[i],length);
                                           &extended_row.str[extended_row.length],
                                           row[i],length);
                  extended_row.str[extended_row.length]='\0';
                  dynstr_append(&extended_row,"'");
                }
	      }
	      else
	      {
		/* change any strings ("inf", "-inf", "nan") into NULL */
@@ -1591,6 +1622,18 @@ static void dumpTable(uint numFields, char *table)
		print_quoted_xml(md_result_file, row[i], lengths[i]);
		fputs("</field>\n", md_result_file);
	      }
	      else if (opt_hex_blob && is_blob)
              { /* sakaik got this idea. */
                ulong counter;
                char xx[4];
                unsigned char *ptr= row[i];
                fputs("0x", md_result_file);
                for (counter = 0; counter < lengths[i]; counter++)
                {
                  sprintf(xx, "%02X", ptr[counter]);
                  fputs(xx, md_result_file);
                }
              }
              else
                unescape(md_result_file, row[i], lengths[i]);
	    }
+176 −49
Original line number Diff line number Diff line
@@ -58,13 +58,6 @@
#include <stdarg.h>
#include <sys/stat.h>
#include <violite.h>
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif

#ifndef MAXPATHLEN
#define MAXPATHLEN 256
#endif

#define MAX_QUERY     131072
#define MAX_VAR_NAME	256
@@ -102,6 +95,38 @@ enum {OPT_MANAGER_USER=256,OPT_MANAGER_HOST,OPT_MANAGER_PASSWD,
      OPT_SSL_SSL, OPT_SSL_KEY, OPT_SSL_CERT, OPT_SSL_CA, OPT_SSL_CAPATH,
      OPT_SSL_CIPHER};

/* ************************************************************************ */
/*
  A line that starts with !$ or $S, and the list of error codes to
  --error are stored in an internal array of structs. This struct can
  hold numeric SQL error codes or SQLSTATE codes as strings. The
  element next to the last active element in the list is set to type
  ERR_EMPTY. When an SQL statement return an error we use this list to
  check if this  is an expected error.
*/
 
enum match_err_type
{
  ERR_EMPTY= 0,
  ERR_ERRNO,
  ERR_SQLSTATE
};

typedef struct
{
  enum match_err_type type;
  union
  {
    uint errnum;
    char sqlstate[SQLSTATE_LENGTH+1];  /* \0 terminated string */
  } code;
} match_err;

static match_err global_expected_errno[MAX_EXPECTED_ERRORS];
static uint global_expected_errors;

/* ************************************************************************ */

static int record = 0, opt_sleep=0;
static char *db = 0, *pass=0;
const char* user = 0, *host = 0, *unix_sock = 0, *opt_basedir="./";
@@ -131,8 +156,8 @@ static int *cur_block, *block_stack_end;
static int block_stack[BLOCK_STACK_DEPTH];

static int block_ok_stack[BLOCK_STACK_DEPTH];
static uint global_expected_errno[MAX_EXPECTED_ERRORS], global_expected_errors;
static CHARSET_INFO *charset_info= &my_charset_latin1;
static CHARSET_INFO *charset_info= &my_charset_latin1; /* Default charset */
static char *charset_name = "latin1"; /* Default character set name */

static int embedded_server_arg_count=0;
static char *embedded_server_args[MAX_SERVER_ARGS];
@@ -245,6 +270,7 @@ Q_EXEC, Q_DELIMITER,
Q_DISPLAY_VERTICAL_RESULTS, Q_DISPLAY_HORIZONTAL_RESULTS,
Q_QUERY_VERTICAL, Q_QUERY_HORIZONTAL,
Q_START_TIMER, Q_END_TIMER,
Q_CHARACTER_SET,

Q_UNKNOWN,			       /* Unknown command.   */
Q_COMMENT,			       /* Comments, ignored. */
@@ -257,7 +283,7 @@ struct st_query
  char *query, *query_buf,*first_argument,*end;
  int first_word_len;
  my_bool abort_on_error, require_file;
  uint expected_errno[MAX_EXPECTED_ERRORS];
  match_err expected_errno[MAX_EXPECTED_ERRORS];
  uint expected_errors;
  char record_file[FN_REFLEN];
  enum enum_commands type;
@@ -325,6 +351,7 @@ const char *command_names[]=
  "query_horizontal",
  "start_timer",
  "end_timer",
  "character_set",
  0
};

@@ -346,6 +373,7 @@ int dyn_string_cmp(DYNAMIC_STRING* ds, const char *fname);
void reject_dump(const char *record_file, char *buf, int size);

int close_connection(struct st_query* q);
static void set_charset(struct st_query*);
VAR* var_get(const char *var_name, const char** var_name_end, my_bool raw,
	     my_bool ignore_not_existing);
int eval_expr(VAR* v, const char *p, const char** p_end);
@@ -1246,25 +1274,58 @@ static void get_file_name(char *filename, struct st_query* q)
  p[0]=0;
}

static void set_charset(struct st_query* q)
{
  char* charset_name= q->first_argument;
  char* tmp;

static uint get_ints(uint *to,struct st_query* q)
  if (!charset_name || !*charset_name)
    die("Missing charset name in 'character_set'\n");
  /* Remove end space */
  tmp= charset_name;
  while (*tmp && !my_isspace(charset_info,*tmp))
    tmp++;
  *tmp= 0;

  charset_info= get_charset_by_csname(charset_name,MY_CS_PRIMARY,MYF(MY_WME));
  if (!charset_info)
    abort_not_supported_test();
}

static uint get_errcodes(match_err *to,struct st_query* q)
{
  char* p= q->first_argument;
  long val;
  uint count= 0;
  DBUG_ENTER("get_ints");
  DBUG_ENTER("get_errcodes");

  if (!*p)
    die("Missing argument in %s\n", q->query);

  for (; (p=str2int(p,10,(long) INT_MIN, (long) INT_MAX, &val)) ; p++)
  do
  {
    count++;
    *to++= (uint) val;
    if (*p != ',')
      break;
    if (*p == 'S')
    {
      /* SQLSTATE string */
      int i;
      p++;
      for (i = 0; my_isalnum(charset_info, *p) && i < SQLSTATE_LENGTH; p++, i++)
        to[count].code.sqlstate[i]= *p;
      to[count].code.sqlstate[i]= '\0';
      to[count].type= ERR_SQLSTATE;
    }
    else
    {
      long val;
      p=str2int(p,10,(long) INT_MIN, (long) INT_MAX, &val);
      if (p == NULL)
        die("Invalid argument in %s\n", q->query);
      to[count].code.errnum= (uint) val;
      to[count].type= ERR_ERRNO;
    }
  *to++=0;					/* End of data */
    count++;
  } while (*(p++) == ',');

  to[count].type= ERR_EMPTY;                        /* End of data */
  DBUG_RETURN(count);
}

@@ -1590,7 +1651,7 @@ int do_connect(struct st_query* q)
  if (opt_compress)
    mysql_options(&next_con->mysql,MYSQL_OPT_COMPRESS,NullS);
  mysql_options(&next_con->mysql, MYSQL_OPT_LOCAL_INFILE, 0);
  mysql_options(&next_con->mysql, MYSQL_SET_CHARSET_NAME, "latin1");
  mysql_options(&next_con->mysql, MYSQL_SET_CHARSET_NAME, charset_name);

#ifdef HAVE_OPENSSL
  if (opt_use_ssl)
@@ -1736,6 +1797,7 @@ int read_line(char* buf, int size)
    c= my_getc(*cur_file);
    if (feof(*cur_file))
    {
  found_eof:
      if ((*cur_file) != stdin)
	my_fclose(*cur_file, MYF(0));
      cur_file--;
@@ -1845,8 +1907,40 @@ int read_line(char* buf, int size)
    }

    if (!no_save)
    {
      /* Could be a multibyte character */
      /* This code is based on the code in "sql_load.cc" */
#ifdef USE_MB
      int charlen = my_mbcharlen(charset_info, c);
      /* We give up if multibyte character is started but not */
      /* completed before we pass buf_end */
      if ((charlen > 1) && (p + charlen) <= buf_end)
      {
	int i;
	char* mb_start = p;

	*p++ = c;

	for (i= 1; i < charlen; i++)
	{
	  if (feof(*cur_file))
	    goto found_eof;	/* FIXME: could we just break here?! */
	  c= my_getc(*cur_file);
	  *p++ = c;
	}
	if (! my_ismbchar(charset_info, mb_start, p))
	{
	  /* It was not a multiline char, push back the characters */
	  /* We leave first 'c', i.e. pretend it was a normal char */
	  while (p > mb_start)
	    my_ungetc(*--p);
	}
      }
      else
#endif
	*p++= c;
    }
  }
  *p= 0;					/* Always end with \0 */
  DBUG_RETURN(feof(*cur_file));
}
@@ -1857,7 +1951,6 @@ static char read_query_buf[MAX_QUERY];
int read_query(struct st_query** q_ptr)
{
  char *p = read_query_buf, * p1 ;
  int expected_errno;
  struct st_query* q;
  DBUG_ENTER("read_query");

@@ -1907,12 +2000,24 @@ int read_query(struct st_query** q_ptr)
      p++;
      if (*p == '$')
      {
	expected_errno= 0;
        int expected_errno= 0;
        p++;
        for (; my_isdigit(charset_info, *p); p++)
          expected_errno = expected_errno * 10 + *p - '0';
	q->expected_errno[0] = expected_errno;
	q->expected_errno[1] = 0;
        q->expected_errno[0].code.errnum = expected_errno;
        q->expected_errno[0].type= ERR_ERRNO;
        q->expected_errno[1].type= ERR_EMPTY;
        q->expected_errors=1;
      }
      else if (*p == 'S')                            /* SQLSTATE */
      {
        int i;
        p++;
        for (i = 0; my_isalnum(charset_info, *p) && i < SQLSTATE_LENGTH; p++, i++)
          q->expected_errno[0].code.sqlstate[i]= *p;
        q->expected_errno[0].code.sqlstate[i]= '\0';
        q->expected_errno[0].type= ERR_SQLSTATE;
        q->expected_errno[1].type= ERR_EMPTY;
        q->expected_errors=1;
      }
    }
@@ -2105,10 +2210,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
      embedded_server_arg_count=1;
      embedded_server_args[0]= (char*) "";
    }
    embedded_server_args[embedded_server_arg_count++]=
      my_strdup(argument, MYF(MY_FAE));
    if (embedded_server_arg_count == MAX_SERVER_ARGS ||
	!embedded_server_args[embedded_server_arg_count-1])
    if (embedded_server_arg_count == MAX_SERVER_ARGS-1 ||
        !(embedded_server_args[embedded_server_arg_count++]=
          my_strdup(argument, MYF(MY_FAE))))
    {
      die("Can't use server argument");
    }
@@ -2166,7 +2270,7 @@ char* safe_str_append(char* buf, const char* str, int size)
void str_to_file(const char* fname, char* str, int size)
{
  int fd;
  char buff[MAXPATHLEN];
  char buff[FN_REFLEN];
  if (!test_if_hard_path(fname))
  {
    strxmov(buff, opt_basedir, fname, NullS);
@@ -2300,7 +2404,7 @@ int run_query(MYSQL* mysql, struct st_query* q, int flags)
  if (flags & QUERY_SEND)
  {
    got_error_on_send= mysql_send_query(mysql, query, query_len);
    if (got_error_on_send && !q->expected_errno[0])
    if (got_error_on_send && q->expected_errno[0].type == ERR_EMPTY)
      die("At line %u: unable to send query '%s' (mysql_errno=%d , errno=%d)",
	  start_lineno, query, mysql_errno(mysql), errno);
  }
@@ -2332,7 +2436,10 @@ int run_query(MYSQL* mysql, struct st_query* q, int flags)
      {
	for (i=0 ; (uint) i < q->expected_errors ; i++)
	{
	  if ((q->expected_errno[i] == mysql_errno(mysql)))
          if (((q->expected_errno[i].type == ERR_ERRNO) &&
               (q->expected_errno[i].code.errnum == mysql_errno(mysql))) ||
              ((q->expected_errno[i].type == ERR_SQLSTATE) &&
               (strcmp(q->expected_errno[i].code.sqlstate,mysql_sqlstate(mysql)) == 0)))
	  {
	    if (i == 0 && q->expected_errors == 1)
	    {
@@ -2346,7 +2453,9 @@ int run_query(MYSQL* mysql, struct st_query* q, int flags)
	      dynstr_append_mem(ds,"\n",1);
	    }
	    /* Don't log error if we may not get an error */
	    else if (q->expected_errno[0] != 0)
            else if (q->expected_errno[0].type == ERR_SQLSTATE ||
                     (q->expected_errno[0].type == ERR_ERRNO &&
                      q->expected_errno[0].code.errnum != 0))
	      dynstr_append(ds,"Got one of the listed errors\n");
	    goto end;				/* Ok */
	  }
@@ -2362,8 +2471,12 @@ int run_query(MYSQL* mysql, struct st_query* q, int flags)
	dynstr_append_mem(ds,"\n",1);
	if (i)
	{
          if (q->expected_errno[0].type == ERR_ERRNO)
            verbose_msg("query '%s' failed with wrong errno %d instead of %d...",
		      q->query, mysql_errno(mysql), q->expected_errno[0]);
                        q->query, mysql_errno(mysql), q->expected_errno[0].code.errnum);
          else
            verbose_msg("query '%s' failed with wrong sqlstate %s instead of %s...",
                        q->query, mysql_sqlstate(mysql), q->expected_errno[0].code.sqlstate);
	  error= 1;
	  goto end;
	}
@@ -2383,11 +2496,22 @@ int run_query(MYSQL* mysql, struct st_query* q, int flags)
	}*/
    }

    if (q->expected_errno[0])
    if (q->expected_errno[0].type == ERR_ERRNO &&
        q->expected_errno[0].code.errnum != 0)
    {
      error = 1;
      /* Error code we wanted was != 0, i.e. not an expected success */
      verbose_msg("query '%s' succeeded - should have failed with errno %d...",
		  q->query, q->expected_errno[0]);
                  q->query, q->expected_errno[0].code.errnum);
      error = 1;
      goto end;
    }
    else if (q->expected_errno[0].type == ERR_SQLSTATE &&
             strcmp(q->expected_errno[0].code.sqlstate,"00000") != 0)
    {
      /* SQLSTATE we wanted was != "00000", i.e. not an expected success */
      verbose_msg("query '%s' succeeded - should have failed with sqlstate %s...",
                  q->query, q->expected_errno[0].code.sqlstate);
      error = 1;
      goto end;
    }

@@ -2678,7 +2802,7 @@ int main(int argc, char **argv)
  if (opt_compress)
    mysql_options(&cur_con->mysql,MYSQL_OPT_COMPRESS,NullS);
  mysql_options(&cur_con->mysql, MYSQL_OPT_LOCAL_INFILE, 0);
  mysql_options(&cur_con->mysql, MYSQL_SET_CHARSET_NAME, "latin1");
  mysql_options(&cur_con->mysql, MYSQL_SET_CHARSET_NAME, charset_name);

#ifdef HAVE_OPENSSL
  if (opt_use_ssl)
@@ -2818,7 +2942,7 @@ int main(int argc, char **argv)
	require_file=0;
	break;
      case Q_ERROR:
	global_expected_errors=get_ints(global_expected_errno,q);
        global_expected_errors=get_errcodes(global_expected_errno,q);
	break;
      case Q_REQUIRE:
	get_file_name(save_file,q);
@@ -2863,6 +2987,9 @@ int main(int argc, char **argv)
	timer_output();
	got_end_timer= TRUE;
	break;
      case Q_CHARACTER_SET: 
	set_charset(q);
	break;
      default: processed = 0; break;
      }
    }
@@ -2979,10 +3106,10 @@ static void timer_output(void)
{
  if (timer_file)
  {
    char buf[1024];
    char buf[32], *end;
    ulonglong timer= timer_now() - timer_start;
    sprintf(buf,"%llu",timer);
    str_to_file(timer_file,buf,strlen(buf));
    end= longlong2str(timer, buf, 10);
    str_to_file(timer_file,buf, (int) (end-buf));
  }
}

+42 −29
Original line number Diff line number Diff line
@@ -63,7 +63,7 @@ __weak_alias(vis,_vis)
#include <limits.h>
#include <stdio.h>
#include <string.h>

#include <assert.h>
#undef BELL
#if defined(__STDC__)
#define BELL '\a'
@@ -79,22 +79,24 @@ __weak_alias(vis,_vis)
#define MAXEXTRAS       5


#define MAKEEXTRALIST(flag, extra, orig)				      \
do {									      \
	const char *o = orig;						      \
	char *e;						      	      \
	while (*o++)							      \
		continue;						      \
	extra = alloca((size_t)((o - orig) + MAXEXTRAS));	      	      \
	for (o = orig, e = extra; (*e++ = *o++) != '\0';)		      \
		continue;						      \
	e--;								      \
	if (flag & VIS_SP) *e++ = ' ';				      	      \
	if (flag & VIS_TAB) *e++ = '\t';				      \
	if (flag & VIS_NL) *e++ = '\n';				      	      \
	if ((flag & VIS_NOSLASH) == 0) *e++ = '\\';		      	      \
	*e = '\0';							      \
} while (/*CONSTCOND*/0)
char *MAKEEXTRALIST(unsigned int flag, const char *orig)
{								
  const char *o = orig;
  char *e, *extra; 
  while (*o++)
    continue; 
  extra = (char*) malloc((size_t)((o - orig) + MAXEXTRAS));
  assert(extra);
  for (o = orig, e = extra; (*e++ = *o++) != '\0';)
    continue;
  e--;
  if (flag & VIS_SP) *e++ = ' ';
  if (flag & VIS_TAB) *e++ = '\t';
  if (flag & VIS_NL) *e++ = '\n';
  if ((flag & VIS_NOSLASH) == 0) *e++ = '\\';
  *e = '\0';
  return extra;
}


/*
@@ -198,15 +200,16 @@ svis(dst, c, flag, nextc, extra)
	int c, flag, nextc;
	const char *extra;
{
	char *nextra;
	char *nextra, *to_be_freed;
	_DIAGASSERT(dst != NULL);
	_DIAGASSERT(extra != NULL);
	MAKEEXTRALIST(flag, nextra, extra);
	nextra= to_be_freed= MAKEEXTRALIST(flag, extra);
	if (flag & VIS_HTTPSTYLE)
		HVIS(dst, c, flag, nextc, nextra);
	else
		SVIS(dst, c, flag, nextc, nextra);
	*dst = '\0';
	free(to_be_freed);
	return(dst);
}

@@ -235,12 +238,12 @@ strsvis(dst, src, flag, extra)
{
	char c;
	char *start;
	char *nextra;
	char *nextra, *to_be_freed;

	_DIAGASSERT(dst != NULL);
	_DIAGASSERT(src != NULL);
	_DIAGASSERT(extra != NULL);
	MAKEEXTRALIST(flag, nextra, extra);
	nextra= to_be_freed= MAKEEXTRALIST(flag, extra);
	if (flag & VIS_HTTPSTYLE) {
		for (start = dst; (c = *src++) != '\0'; /* empty */)
			HVIS(dst, c, flag, *src, nextra);
@@ -249,6 +252,7 @@ strsvis(dst, src, flag, extra)
			SVIS(dst, c, flag, *src, nextra);
	}
	*dst = '\0';
	free(to_be_freed);
	return (dst - start);
}

@@ -263,12 +267,12 @@ strsvisx(dst, src, len, flag, extra)
{
	char c;
	char *start;
	char *nextra;
	char *nextra, *to_be_freed;

	_DIAGASSERT(dst != NULL);
	_DIAGASSERT(src != NULL);
	_DIAGASSERT(extra != NULL);
	MAKEEXTRALIST(flag, nextra, extra);
	nextra= to_be_freed= MAKEEXTRALIST(flag, extra);

	if (flag & VIS_HTTPSTYLE) {
		for (start = dst; len > 0; len--) {
@@ -282,6 +286,7 @@ strsvisx(dst, src, len, flag, extra)
		}
	}
	*dst = '\0';
	free(to_be_freed);
	return (dst - start);
}

@@ -295,16 +300,18 @@ vis(dst, c, flag, nextc)
	int c, flag, nextc;
	
{
	char *extra;
	char *extra, *to_be_freed;

	_DIAGASSERT(dst != NULL);

	MAKEEXTRALIST(flag, extra, "");
	extra= to_be_freed= MAKEEXTRALIST(flag, "");

	if (flag & VIS_HTTPSTYLE)
	    HVIS(dst, c, flag, nextc, extra);
	else
	    SVIS(dst, c, flag, nextc, extra);
	*dst = '\0';
	free(to_be_freed);
	return (dst);
}

@@ -326,9 +333,12 @@ strvis(dst, src, flag)
	int flag;
{
	char *extra;
	int tmp;

	MAKEEXTRALIST(flag, extra, "");
	return (strsvis(dst, src, flag, extra));
	extra= MAKEEXTRALIST(flag, "");
	tmp= strsvis(dst, src, flag, extra);
	free(extra);
	return tmp;
}


@@ -340,8 +350,11 @@ strvisx(dst, src, len, flag)
	int flag;
{
	char *extra;
	int tmp;

	MAKEEXTRALIST(flag, extra, "");
	return (strsvisx(dst, src, len, flag, extra));
	extra= MAKEEXTRALIST(flag, "");
	tmp= strsvisx(dst, src, len, flag, extra);
	free(extra);
	return tmp;
}
#endif
Loading