summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2014-10-25 14:18:42 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2014-10-25 14:18:42 -0700
commitbbd4273f328e93d429a6edb8872a74f8fb82b259 (patch)
tree287be5486f756d49edead3f16c9b60ca28c711e0
parent9db7347730f3c8c9d77e5be4c9746f6d614ce470 (diff)
Make polygon info const - moves 22k from .data to .rodata
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--ico.c8
-rw-r--r--polyinfo.h5
2 files changed, 7 insertions, 6 deletions
diff --git a/ico.c b/ico.c
index 8c62f93..832ec16 100644
--- a/ico.c
+++ b/ico.c
@@ -468,7 +468,7 @@ icoClearArea(struct closure *closure, int x, int y, int w, int h)
static void
initPoly(struct closure *closure, Polyinfo *poly, int icoW, int icoH)
{
- Point3D *vertices = poly->v;
+ const Point3D *vertices = poly->v;
int NV = poly->numverts;
Transform3D r1;
Transform3D r2;
@@ -477,7 +477,7 @@ initPoly(struct closure *closure, Polyinfo *poly, int icoW, int icoH)
FormatRotateMat('y', 5 * 3.1416 / 180.0, r2);
ConcatMat(r1, r2, closure->xform);
- memcpy((char *)closure->xv[0], (char *)vertices, NV * sizeof(Point3D));
+ memcpy(closure->xv[0], vertices, NV * sizeof(Point3D));
closure->xv_buffer = 0;
closure->wo2 = icoW / 2.0;
@@ -564,7 +564,7 @@ static void
drawPoly(struct closure *closure, Polyinfo *poly, GC gc,
int icoX, int icoY, int icoW, int icoH, int prevX, int prevY)
{
- int *f = poly->f;
+ const int *f = poly->f;
int NV = poly->numverts;
int NF = poly->numfaces;
@@ -577,7 +577,7 @@ drawPoly(struct closure *closure, Polyinfo *poly, GC gc,
XSegment edges[MAXEDGES];
int i;
int j,k;
- int *pf;
+ const int *pf;
int facecolor;
int pcount;
diff --git a/polyinfo.h b/polyinfo.h
index c4b80f1..daf68db 100644
--- a/polyinfo.h
+++ b/polyinfo.h
@@ -16,7 +16,7 @@ typedef struct {
} Point3D;
/* structure of the include files which define the polyhedra */
-typedef struct {
+struct polyinfo {
const char *longname; /* long name of object */
const char *shortname; /* short name of object */
const char *dual; /* long name of dual */
@@ -25,6 +25,7 @@ typedef struct {
int numfaces; /* number of faces */
Point3D v[MAXVERTS]; /* the vertices */
int f[MAXEDGES*2+MAXFACES]; /* the faces */
-} Polyinfo;
+};
+typedef const struct polyinfo Polyinfo;
/* end */