]> granicus.if.org Git - fribidi/commitdiff
packtab.c: Don't use pow as variable name
authorChun-wei Fan <fanchunwei@src.gnome.org>
Tue, 27 Feb 2018 04:27:50 +0000 (12:27 +0800)
committerKhaled Hosny <khaledhosny@eglug.org>
Tue, 27 Feb 2018 08:34:18 +0000 (10:34 +0200)
Visual Studio does not like one using pow as a variable name, as it is
a commonly-used function, as the headers that declare the pow() prototype
get pulled in during the build.

gen.tab/packtab.c

index 197e194dcf750c8fa8d127b29316f0790e56644b..af3988810adb5292176780a1040a1ddde35fbfb4 100644 (file)
@@ -55,7 +55,7 @@ static int n, a, max_depth, digits, tab_width, per_row;
 static long N;
 signed int def_key;
 static uni_table temp, x, perm, *tab;
-static long pow[22], cluster, cmpcluster;
+static long packtab_pow[22], cluster, cmpcluster;
 static const char *const *name, *key_type_name, *table_name, *macro_name;
 static FILE *f;
 
@@ -71,22 +71,22 @@ most_binary (
   if (min == max)
     return max;
 
-  for (i = 21; max < pow[i]; i--)
+  for (i = 21; max < packtab_pow[i]; i--)
     ;
   ii = i;
-  while (i && !((min ^ max) & pow[i]))
+  while (i && !((min ^ max) & packtab_pow[i]))
     i--;
 
   if (ii == i)
     {
       /* min is less than half of max */
-      for (i = 21 - 1; min < pow[i]; i--)
+      for (i = 21 - 1; min < packtab_pow[i]; i--)
        ;
       i++;
-      return pow[i];
+      return packtab_pow[i];
     }
 
-  return max & (pow[i] - 1);
+  return max & (packtab_pow[i] - 1);
 }
 
 static void
@@ -97,9 +97,9 @@ init (
   register int i;
 
   /* initialize powers of two */
-  pow[0] = 1;
+  packtab_pow[0] = 1;
   for (i = 1; i <= 21; i++)
-    pow[i] = pow[i - 1] << 1;
+    packtab_pow[i] = packtab_pow[i - 1] << 1;
 
   /* reduce number of elements to get a more binary number */
   {
@@ -114,13 +114,13 @@ init (
     N = most_binary (essen, N);
   }
 
-  for (n = 21; N % pow[n]; n--)
+  for (n = 21; N % packtab_pow[n]; n--)
     ;
   digits = (n + 3) / 4;
   for (i = 6; i; i--)
-    if (pow[i] * (tab_width + 1) < 80)
+    if (packtab_pow[i] * (tab_width + 1) < 80)
       break;
-  per_row = pow[i];
+  per_row = packtab_pow[i];
 }
 
 static int
@@ -180,7 +180,7 @@ bt (
   for (i = 1 - t[lev] % 2; i <= nn + (t[lev] >> nn) % 2; i++)
     {
       nn -= (p[lev] = i);
-      clusters[lev] = cluster = (i && nn >= 0) ? pow[i] : t[lev];
+      clusters[lev] = cluster = (i && nn >= 0) ? packtab_pow[i] : t[lev];
       cmpcluster = cluster + 1;
 
       t[lev + 1] = (t[lev] - 1) / cluster + 1;
@@ -305,7 +305,7 @@ write_array (
     {
       int kk, jj;
       fprintf (f, "\n#define %sLev%d_%0*lX 0x%0X", table_name,
-              best_lev - lev - 1, digits, x[i] * pow[n - nn], ofs);
+              best_lev - lev - 1, digits, x[i] * packtab_pow[n - nn], ofs);
       kk = x[i] * cluster;
       if (!lev)
        if (name)
@@ -326,9 +326,9 @@ write_array (
        for (j = 0; j < cluster; j++, kk++)
          fprintf (f, "\n  %sLev%d_%0*lX,  /* %0*lX..%0*lX */", table_name,
                   best_lev - lev, digits,
-                  tab[lev][kk] * pow[n - nn - best_p[lev]], digits,
-                  x[i] * pow[n - nn] + j * pow[n - nn - best_p[lev]], digits,
-                  x[i] * pow[n - nn] + (j + 1) * pow[n - nn - best_p[lev]] -
+                  tab[lev][kk] * packtab_pow[n - nn - best_p[lev]], digits,
+                  x[i] * packtab_pow[n - nn] + j * packtab_pow[n - nn - best_p[lev]], digits,
+                  x[i] * packtab_pow[n - nn] + (j + 1) * packtab_pow[n - nn - best_p[lev]] -
                   1);
       ofs += cluster;
       jj = i;
@@ -372,7 +372,7 @@ write_source (
       if (j != 0)
        fprintf (f, " >> %d", j);
       if (i)
-       fprintf (f, " & 0x%02lx) +", pow[best_p[best_lev - 1 - i]] - 1);
+       fprintf (f, " & 0x%02lx) +", packtab_pow[best_p[best_lev - 1 - i]] - 1);
       j += best_p[best_lev - 1 - i];
     }
   fprintf (f, ")");