Address `-Wnull-dereference' warnings from GCC 10.x.

Bump SONAME accordingly.

Fixes #298.

Change-Id: Ied9fd343a1627f49719c0ff0779503493124870e
Reviewed-on: https://code-review.googlesource.com/c/re2/+/58190
Reviewed-by: Paul Wankadia <junyer@google.com>
diff --git a/Makefile b/Makefile
index 44cedee..9dab631 100644
--- a/Makefile
+++ b/Makefile
@@ -44,7 +44,7 @@
 
 # ABI version
 # http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html
-SONAME=9
+SONAME=10
 
 # To rebuild the Tables generated by Perl and Python scripts (requires Internet
 # access for Unicode data), uncomment the following line:
diff --git a/re2/nfa.cc b/re2/nfa.cc
index 19ee08d..e858451 100644
--- a/re2/nfa.cc
+++ b/re2/nfa.cc
@@ -600,7 +600,7 @@
     // by simply not continuing the loop.
     // This complements the special case in NFA::Step().
     if (p == NULL) {
-      (void)Step(runq, nextq, p < etext_ ? p[0] & 0xFF : -1, context, p);
+      (void) Step(runq, nextq, -1, context, p);
       DCHECK_EQ(runq->size(), 0);
       using std::swap;
       swap(nextq, runq);
diff --git a/re2/regexp.cc b/re2/regexp.cc
index 9655dc3..1a38418 100644
--- a/re2/regexp.cc
+++ b/re2/regexp.cc
@@ -919,7 +919,7 @@
 // The ranges are allocated in the same block as the header,
 // necessitating a special allocator and Delete method.
 
-CharClass* CharClass::New(int maxranges) {
+CharClass* CharClass::New(size_t maxranges) {
   CharClass* cc;
   uint8_t* data = new uint8_t[sizeof *cc + maxranges*sizeof cc->ranges_[0]];
   cc = reinterpret_cast<CharClass*>(data);
@@ -936,7 +936,7 @@
 }
 
 CharClass* CharClass::Negate() {
-  CharClass* cc = CharClass::New(nranges_+1);
+  CharClass* cc = CharClass::New(static_cast<size_t>(nranges_+1));
   cc->folds_ascii_ = folds_ascii_;
   cc->nrunes_ = Runemax + 1 - nrunes_;
   int n = 0;
@@ -973,7 +973,7 @@
 }
 
 CharClass* CharClassBuilder::GetCharClass() {
-  CharClass* cc = CharClass::New(static_cast<int>(ranges_.size()));
+  CharClass* cc = CharClass::New(ranges_.size());
   int n = 0;
   for (iterator it = begin(); it != end(); ++it)
     cc->ranges_[n++] = *it;
diff --git a/re2/regexp.h b/re2/regexp.h
index 9ea7a07..61882b5 100644
--- a/re2/regexp.h
+++ b/re2/regexp.h
@@ -86,6 +86,7 @@
 // form accessible to clients, so that client code can analyze the
 // parsed regular expressions.
 
+#include <stddef.h>
 #include <stdint.h>
 #include <map>
 #include <set>
@@ -259,7 +260,7 @@
  private:
   CharClass();  // not implemented
   ~CharClass();  // not implemented
-  static CharClass* New(int maxranges);
+  static CharClass* New(size_t maxranges);
 
   friend class CharClassBuilder;