Has nested functions, because reasons.
This fixes the build with clang, but it crashes on startup here. I don't know if that's new or not.

OK?

~Brian

Index: Makefile
===================================================================
RCS file: /cvs/ports/games/frozen-bubble/Makefile,v
retrieving revision 1.25
diff -u -p -u -p -r1.25 Makefile
--- Makefile	18 May 2016 10:11:48 -0000	1.25
+++ Makefile	28 Jul 2017 20:16:02 -0000
@@ -6,7 +6,7 @@ COMMENT-server =	server for the frozen-b
 VER =			2.2.0
 DISTNAME =		frozen-bubble-${VER}
 PKGNAME-main =		${DISTNAME}
-REVISION-main =		12
+REVISION-main =		13
 PKGNAME-server =	frozen-bubble-server-${VER}
 REVISION-server =	8
 CATEGORIES =		games
Index: patches/patch-c_stuff_fb_c_stuff_xs
===================================================================
RCS file: patches/patch-c_stuff_fb_c_stuff_xs
diff -N patches/patch-c_stuff_fb_c_stuff_xs
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-c_stuff_fb_c_stuff_xs	28 Jul 2017 20:16:02 -0000
@@ -0,0 +1,126 @@
+$OpenBSD$
+
+Why does GNU C allow nested functions?
+
+Index: c_stuff/fb_c_stuff.xs
+--- c_stuff/fb_c_stuff.xs.orig
++++ c_stuff/fb_c_stuff.xs
+@@ -94,17 +94,18 @@ int rand_(double val) { return 1+(int) (val*rand()/(RA
+ 
+ /* -------------- Double Store ------------------ */
+ 
++void copy_line(int l, SDL_Surface * s, SDL_Surface * img) {
++	memcpy(s->pixels + l*img->pitch, img->pixels + l*img->pitch, img->pitch);
++}
++
++void copy_column(int c, SDL_Surface * s, SDL_Surface * img) {
++	int bpp = img->format->BytesPerPixel;
++	for (y=0; y<YRES; y++)
++		memcpy(s->pixels + y*img->pitch + c*bpp, img->pixels + y*img->pitch + c*bpp, bpp);
++}
++
+ void store_effect(SDL_Surface * s, SDL_Surface * img)
+ {
+-	void copy_line(int l) {
+-		memcpy(s->pixels + l*img->pitch, img->pixels + l*img->pitch, img->pitch);
+-	}
+-	void copy_column(int c) {
+-		int bpp = img->format->BytesPerPixel;
+-		for (y=0; y<YRES; y++)
+-			memcpy(s->pixels + y*img->pitch + c*bpp, img->pixels + y*img->pitch + c*bpp, bpp);
+-	}
+-
+ 	int step = 0;
+ 	int store_thickness = 15;
+ 
+@@ -116,8 +117,8 @@ void store_effect(SDL_Surface * s, SDL_Surface * img)
+ 			for (i=0; i<=YRES/2/store_thickness; i++) {
+ 				int v = step - i;
+ 				if (v >= 0 && v < store_thickness) {
+-					copy_line(i*store_thickness + v);
+-					copy_line(YRES - 1 - (i*store_thickness + v));
++					copy_line(i*store_thickness + v, s, img);
++					copy_line(YRES - 1 - (i*store_thickness + v), s, img);
+ 				}
+ 			}
+ 			step++;
+@@ -133,8 +134,8 @@ void store_effect(SDL_Surface * s, SDL_Surface * img)
+ 			for (i=0; i<=XRES/2/store_thickness; i++) {
+ 				int v = step - i;
+ 				if (v >= 0 && v < store_thickness) {
+-					copy_column(i*store_thickness + v);
+-					copy_column(XRES - 1 - (i*store_thickness + v));
++					copy_column(i*store_thickness + v, s, img);
++					copy_column(XRES - 1 - (i*store_thickness + v), s, img);
+ 				}
+ 			}
+ 			step++;
+@@ -176,21 +177,21 @@ void bars_effect(SDL_Surface * s, SDL_Surface * img)
+ 
+ /* -------------- Squares ------------------ */
+ 
++int fillrect(int i, int j, SDL_Surface * s, SDL_Surface * img, const int squares_size, int bpp) {
++	int c, v;
++	if (i >= XRES/squares_size || j >= YRES/squares_size)
++		return 0;
++	v = i*squares_size*bpp + j*squares_size*img->pitch;
++	for (c=0; c<squares_size; c++)
++		memcpy(s->pixels + v + c*img->pitch, img->pixels + v + c*img->pitch, squares_size*bpp);
++	return 1;
++}
++
+ void squares_effect(SDL_Surface * s, SDL_Surface * img)
+ {
+ 	int bpp = img->format->BytesPerPixel;
+ 	const int squares_size = 32;
+ 
+-	int fillrect(int i, int j) {
+-		int c, v;
+-		if (i >= XRES/squares_size || j >= YRES/squares_size)
+-			return 0;
+-		v = i*squares_size*bpp + j*squares_size*img->pitch;
+-		for (c=0; c<squares_size; c++)
+-			memcpy(s->pixels + v + c*img->pitch, img->pixels + v + c*img->pitch, squares_size*bpp);
+-		return 1;
+-	}
+-
+ 	int still_moving = 1;
+ 
+ 	for (i=0; still_moving; i++) {
+@@ -200,7 +201,7 @@ void squares_effect(SDL_Surface * s, SDL_Surface * img
+ 
+ 		still_moving = 0;
+ 		for (j=i; j>=0; j--) {
+-			if (fillrect(j, k))
++			if (fillrect(j, k, s, img, squares_size, bpp))
+ 				still_moving = 1;
+ 			k++;
+ 		}
+@@ -212,11 +213,15 @@ void squares_effect(SDL_Surface * s, SDL_Surface * img
+ 
+ /* -------------- Circle ------------------ */
+ 
++int isqr(int v)
++{
++	return v*v;
++}
++
+ int * circle_steps;
+ const int circle_max_steps = 40;
+ void circle_init(void)
+ {
+-	int sqr(int v) { return v*v; }
+ 
+ 	circle_steps = malloc(XRES * YRES * sizeof(int));
+ 	if (!circle_steps)
+@@ -224,8 +229,8 @@ void circle_init(void)
+ 
+ 	for (y=0; y<YRES; y++)
+ 		for (x=0; x<XRES; x++) {
+-			int max = sqrt(sqr(XRES/2) + sqr(YRES/2));
+-			int value = sqrt(sqr(x-XRES/2) + sqr(y-YRES/2));
++			int max = sqrt(isqr(XRES/2) + isqr(YRES/2));
++			int value = sqrt(isqr(x-XRES/2) + isqr(y-YRES/2));
+ 			circle_steps[x+y*XRES] = (max-value)*circle_max_steps/max;
+ 		}
+ }

Reply via email to