Skip to content

Commit

Permalink
Fix compile error under macOS Big Sur
Browse files Browse the repository at this point in the history
rdiscount.c:53:17: error: implicit declaration of function
'rb_rdiscount__get_flags' is invalid in C99
[-Werror,-Wimplicit-function-declaration]
    int flags = rb_rdiscount__get_flags(self);
                ^
rdiscount.c:96:17: error: implicit declaration of function
'rb_rdiscount__get_flags' is invalid in C99
[-Werror,-Wimplicit-function-declaration]
    int flags = rb_rdiscount__get_flags(self);
                ^
  • Loading branch information
Bo98 committed Jun 24, 2020
1 parent 676a381 commit 48cf5d5
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions ext/rdiscount.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,28 @@ static AccessorFlagPair ACCESSOR_2_FLAG[] = {

static VALUE rb_cRDiscount;

int rb_rdiscount__get_flags(VALUE ruby_obj)
{
AccessorFlagPair *entry;

/* compile flags */
int flags = MKD_TABSTOP | MKD_NOHEADER | MKD_DLEXTRA | MKD_FENCEDCODE | MKD_GITHUBTAGS;

/* The "smart" accessor turns OFF the MKD_NOPANTS flag. */
if ( rb_funcall(ruby_obj, rb_intern("smart"), 0) != Qtrue ) {
flags = flags | MKD_NOPANTS;
}

/* Handle standard flags declared in ACCESSOR_2_FLAG */
for ( entry = ACCESSOR_2_FLAG; entry->accessor_name; entry++ ) {
if ( rb_funcall(ruby_obj, rb_intern(entry->accessor_name), 0) == Qtrue ) {
flags = flags | entry->flag;
}
}

return flags;
}

static VALUE
rb_rdiscount_to_html(int argc, VALUE *argv, VALUE self)
{
Expand Down Expand Up @@ -117,28 +139,6 @@ rb_rdiscount_toc_content(int argc, VALUE *argv, VALUE self)
return buf;
}

int rb_rdiscount__get_flags(VALUE ruby_obj)
{
AccessorFlagPair *entry;

/* compile flags */
int flags = MKD_TABSTOP | MKD_NOHEADER | MKD_DLEXTRA | MKD_FENCEDCODE | MKD_GITHUBTAGS;

/* The "smart" accessor turns OFF the MKD_NOPANTS flag. */
if ( rb_funcall(ruby_obj, rb_intern("smart"), 0) != Qtrue ) {
flags = flags | MKD_NOPANTS;
}

/* Handle standard flags declared in ACCESSOR_2_FLAG */
for ( entry = ACCESSOR_2_FLAG; entry->accessor_name; entry++ ) {
if ( rb_funcall(ruby_obj, rb_intern(entry->accessor_name), 0) == Qtrue ) {
flags = flags | entry->flag;
}
}

return flags;
}


void Init_rdiscount()
{
Expand Down

0 comments on commit 48cf5d5

Please sign in to comment.