Skip to content

Commit

Permalink
Fix wrapped_lines variable declaration (extern)
Browse files Browse the repository at this point in the history
Signed-off-by: Holger Levsen <[email protected]>
  • Loading branch information
frikiluser authored and h01ger committed Nov 21, 2020
1 parent f347fda commit f36ec17
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/t4k_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ MFStrategy;
#define MAX_LINES 128 //!< Maximum lines to wrap.
#define MAX_LINEWIDTH 256 //!< Maximum characters of each line.

static char wrapped_lines[MAX_LINES][MAX_LINEWIDTH]; //!< Global buffer for wrapped lines.
extern static char wrapped_lines[MAX_LINES][MAX_LINEWIDTH]; //!< Global buffer for wrapped lines.

//TODO separate headers for different areas a la SDL?

Expand Down

7 comments on commit f36ec17

@mphilipp
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Antoni and Holger,

due to this change, GCC 10 complains about multiple storage classes in declaration of of wrapped_lines. The declaration in the header file cannot be both, static, and extern.
What was the original motivation for this change?

From a quick browse of the code, I don't see any need to maintain a shared global wrapped_lines buffer, because users of T4K_LineWrapList() provide their own output buffer.
On the other hand, it is undesirable to declare a static buffer in the common header file because every inclusion of the header file will instantiate a copy of the static buffer, even if it is not used.

I would suggest to completely remove the declaration from the common header file and let users of T4K_LineWrapList() define their own buffer variables. I'm not sure about other users of t4kcommon, but for tuxmath this would only affect campaign.c and credits.c.

I'd be happy to provide patches!
Cheers, Matthias

@h01ger
Copy link
Contributor

@h01ger h01ger commented on f36ec17 Dec 30, 2020 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mphilipp
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! What is the recommened workflow?
I wanted to create a pull request and therefore created a branch in my local clone of the repository but it seems I'm not allowed to push it: remote: Permission to tux4kids/t4kcommon.git denied to mphilipp

@h01ger
Copy link
Contributor

@h01ger h01ger commented on f36ec17 Dec 30, 2020 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mphilipp
Copy link

@mphilipp mphilipp commented on f36ec17 Dec 30, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you try the webui?

Yes. There is no button to create a branch in the branches drop-down list.

@h01ger
Copy link
Contributor

@h01ger h01ger commented on f36ec17 Dec 30, 2020 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wjt
Copy link
Contributor

@wjt wjt commented on f36ec17 Mar 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I filed #10 which corrects the definition of this global variable, among other build fixes.

Please sign in to comment.