#include "fmt.h"

size_t fmt_escapecharxml(char* dest,uint32_t ch) {
  char a[FMT_LONG], b[FMT_XLONG];
  const char* s;
  size_t i,j;
  switch (ch) {
  case '&': s="&amp;"; goto string;
  case '<': s="&lt;"; goto string;
  case '>': s="&gt;"; goto string;
  case '\'': s="&apos;"; goto string;
  case '"': s="&quot;"; goto string;
  default:
    a[i=fmt_ulong(a,ch)]=0;
    b[0]='x';
    b[j=fmt_xlong(b+1,ch)+1]=0;
    s=a;
    if (i>j) { s=b; i=j; }
    if (dest) {
      dest[0]='&';
      dest[1]='#';
      byte_copy(dest+2,i,s);
      dest[i+2]=';';
    }
    return i+3;
  }
string:
  return fmt_str(dest,s);
}

#ifdef __GNUC__
size_t fmt_escapecharhtml(char* dest,uint32_t ch) __attribute__((__alias__("fmt_escapecharxml")));
#endif

#include "fmt.h"

size_t fmt_escapecharxml(char* dest,uint32_t ch) {
  char a[FMT_LONG], b[FMT_XLONG];
  const char* s;
  size_t i,j;
  switch (ch) {
  case '&': s="&amp;"; goto string;
  case '<': s="&lt;"; goto string;
  case '>': s="&gt;"; goto string;
  case '\'': s="&apos;"; goto string;
  case '"': s="&quot;"; goto string;
  default:
    a[i=fmt_ulong(a,ch)]=0;
    b[0]='x';
    b[j=fmt_xlong(b+1,ch)+1]=0;
    s=a;
    if (i>j) { s=b; i=j; }
    if (dest) {
      dest[0]='&';
      dest[1]='#';
      byte_copy(dest+2,i,s);
      dest[i+2]=';';
    }
    return i+3;
  }
string:
  return fmt_str(dest,s);
}

#if defined(__GNUC__) && !defined(__llvm__)
size_t fmt_escapecharhtml(char* dest,uint32_t ch) __attribute__((__alias__("fmt_escapecharxml")));
#endif

Choose only gcc to execute a specific portion of code
fmt: Choose only gcc to execute a specific portion of code

The specific portion of the code needs to be executed by a gcc
compiler, for that reason is used the __GNUC__ macro. It appears,
that the LLVM compiler, which uses the __llvm__ macro, uses as well
the __GNUC__ macro (possible for compatibility???).

This change check if the __llvm__ is check as well, and if it is
the code is not executed.

Issue: https://github.com/svagionitis/cross-platform-code/issues/1
