switch (parsing) { case XML_SUSPENDED: errorCode = XML_ERROR_SUSPENDED; return NULL; case XML_FINISHED: errorCode = XML_ERROR_FINISHED; return NULL; default: ; }
XML_GetBuffer(XML_Parser parser, int len){  if (len > bufferLim - bufferEnd) {    /* FIXME avoid integer overflow */    int neededSize = len + (bufferEnd - bufferPtr);#ifdef XML_CONTEXT_BYTES    int keep = bufferPtr - buffer;    if (keep > XML_CONTEXT_BYTES)      keep = XML_CONTEXT_BYTES;    neededSize += keep;#endif  /* defined XML_CONTEXT_BYTES */    if (neededSize  <= bufferLim - buffer) {#ifdef XML_CONTEXT_BYTES      if (keep < bufferPtr - buffer) {        int offset = (bufferPtr - buffer) - keep;        memmove(buffer, &buffer[offset], bufferEnd - bufferPtr + keep);        bufferEnd -= offset;        bufferPtr -= offset;      }#else      memmove(buffer, bufferPtr, bufferEnd - bufferPtr);      bufferEnd = buffer + (bufferEnd - bufferPtr);      bufferPtr = buffer;#endif  /* not defined XML_CONTEXT_BYTES */    }    else {      char *newBuf;      int bufferSize = bufferLim - bufferPtr;      if (bufferSize == 0)        bufferSize = INIT_BUFFER_SIZE;      do {        bufferSize *= 2;      } while (bufferSize < neededSize);      newBuf = (char *)MALLOC(bufferSize);      if (newBuf == 0) {        errorCode = XML_ERROR_NO_MEMORY;        return NULL;      }      bufferLim = newBuf + bufferSize;#ifdef XML_CONTEXT_BYTES      if (bufferPtr) {        int keep = bufferPtr - buffer;        if (keep > XML_CONTEXT_BYTES)          keep = XML_CONTEXT_BYTES;        memcpy(newBuf, &bufferPtr[-keep], bufferEnd - bufferPtr + keep);        FREE(buffer);        buffer = newBuf;        bufferEnd = buffer + (bufferEnd - bufferPtr) + keep;        bufferPtr = buffer + keep;      }      else {        bufferEnd = newBuf + (bufferEnd - bufferPtr);        bufferPtr = buffer = newBuf;      }#else      if (bufferPtr) {        memcpy(newBuf, bufferPtr, bufferEnd - bufferPtr);        FREE(buffer);      }      bufferEnd = newBuf + (bufferEnd - bufferPtr);      bufferPtr = buffer = newBuf;#endif  /* not defined XML_CONTEXT_BYTES */    }  }  return bufferEnd;}