Changeset 1811 for trunk/src/kmk/misc.c


Ignore:
Timestamp:
Oct 10, 2008, 7:19:58 AM (17 years ago)
Author:
bird
Message:

kmk: More string length optimizations.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kmk/misc.c

    r1535 r1811  
    2020#include "dep.h"
    2121#include "debug.h"
     22#ifdef CONFIG_WITH_VALUE_LENGTH
     23# include <assert.h>
     24#endif
    2225
    2326/* All bcopy calls in this file can be replaced by memcpy and save a tick or two. */
     
    8386   This is done by copying the text at LINE into itself.  */
    8487
     88#ifndef CONFIG_WITH_VALUE_LENGTH
    8589void
    8690collapse_continuations (char *line)
     91#else
     92char *
     93collapse_continuations (char *line, unsigned int linelen)
     94#endif
    8795{
    8896  register char *in, *out, *p;
     
    9098  register unsigned int bs_write;
    9199
     100#ifndef CONFIG_WITH_VALUE_LENGTH
    92101  in = strchr (line, '\n');
    93102  if (in == 0)
    94103    return;
     104#else
     105  assert (strlen (line) == linelen);
     106  in = memchr (line, '\n', linelen);
     107  if (in == 0)
     108      return line + linelen;
     109#endif
    95110
    96111  out = in;
     
    158173
    159174  *out = '\0';
     175#ifdef CONFIG_WITH_VALUE_LENGTH
     176  assert (strchr (line, '\0') == out);
     177  return out;
     178#endif
    160179}
    161180
Note: See TracChangeset for help on using the changeset viewer.