jgm/CommonMark — pull request #195 by nwellnhof (2014-11-12 19:07:26+00:00)
Title: Fix namespace pollution

Here's a pull request that prefixes all public identifiers and external symbols with `cmark_`. It also makes some internal functions static. Existing code using `cmark.h` should compile and work without changes. Users who don't want unprefixed names can now define `CMARK_NO_SHORT_NAMES` before including `cmark.h`.

The output of `nm -g --defined-only build/src/libcmark.so` is now:

~~~
00067138 B __bss_start
00007f30 T cmark_clean_autolink
00008020 T cmark_clean_title
00007e40 T cmark_clean_url
0000bda0 T cmark_debug_print
00007990 T cmark_free_inlines
000073f0 T cmark_free_nodes
00005ce0 T cmark_markdown_to_html
00007600 T cmark_parse_document
000074a0 T cmark_parse_file
00008100 T cmark_parse_inlines
000095d0 T cmark_parse_reference_inline
00025c00 T cmark_reference_create
00025db0 T cmark_reference_lookup
00025ed0 T cmark_reference_map_free
00025f70 T cmark_reference_map_new
00026430 T cmark_render_html
00025820 T cmark_strbuf_attach
000253f0 T cmark_strbuf_clear
000258b0 T cmark_strbuf_cmp
00025740 T cmark_strbuf_copy_cstr
000257c0 T cmark_strbuf_detach
000259b0 T cmark_strbuf_drop
000253a0 T cmark_strbuf_free
00025350 T cmark_strbuf_init
0006713a B cmark_strbuf__initbuf
00025ad0 T cmark_strbuf_normalize_whitespace
00067139 B cmark_strbuf__oom
00025710 T cmark_strbuf_printf
00025570 T cmark_strbuf_put
00025500 T cmark_strbuf_putc
000255f0 T cmark_strbuf_puts
00025a00 T cmark_strbuf_rtrim
00025410 T cmark_strbuf_set
000254b0 T cmark_strbuf_sets
00025900 T cmark_strbuf_strchr
00025950 T cmark_strbuf_strrchr
00025790 T cmark_strbuf_swap
00025a60 T cmark_strbuf_trim
00025990 T cmark_strbuf_truncate
00025290 T cmark_strbuf_try_grow
00025b60 T cmark_strbuf_unescape
00025620 T cmark_strbuf_vprintf
00067138 D _edata
0006713c B _end
00027124 T _fini
00026990 T houdini_escape_href
00026c70 T houdini_escape_html
00026b30 T houdini_escape_html0
00026ca0 T houdini_unescape_ent
00026fc0 T houdini_unescape_html
000270c0 T houdini_unescape_html_f
000056cc T _init
0001b3c0 T _scan_atx_header_start
000121c0 T _scan_autolink_email
0000ef10 T _scan_autolink_uri
0001b9a0 T _scan_close_code_fence
0001bac0 T _scan_entity
0001b610 T _scan_hrule
00018b30 T _scan_html_block_tag
000181b0 T _scan_html_tag
0001b0e0 T _scan_link_title
0001a970 T _scan_link_url
0001b870 T _scan_open_code_fence
0001b500 T _scan_setext_header_line
0001b350 T _scan_spacechars
0001cd10 T utf8proc_case_fold
0001c850 T utf8proc_charlen
0001c8e0 T utf8proc_detab
0001cbb0 T utf8proc_encode_char
0001ca70 T utf8proc_iterate
~~~

I left the `utf8proc_*` and `_scan_*` functions unprefixed for now. The `_scan_*` functions should be renamed anyway since identifiers with a leading underscore shouldn't be used for external symbols.