Fix abseil deprecations (original by alona.moony@gmail.com) (#666)

The original work is by Alona Enraght-Moony <alona.moony@gmail.com>
but I'm signing this so it can land.

It was PR https://github.com/google/re2/pull/644 and the author
signed the Google CLA (verified by the CLA-bot).

Author: Alona Enraght-Moony <alona.moony@gmail.com>
Date:   Mon Jun 29 23:08:33 2026 +0100

    Fix abseil lock deprecations

    Fixes https://github.com/google/re2/issues/631

    These were deprecated in
    https://github.com/abseil/abseil-cpp/commit/6d8e1a5cf00d6a6b26069b0baf0dd9b855a17459
diff --git a/re2/dfa.cc b/re2/dfa.cc
index d587a55..338093e 100644
--- a/re2/dfa.cc
+++ b/re2/dfa.cc
@@ -1152,24 +1152,24 @@
 };
 
 DFA::RWLocker::RWLocker(CacheMutex* mu) : mu_(mu), writing_(false) {
-  mu_->ReaderLock();
+  mu_->lock_shared();
 }
 
 // This function is marked as ABSL_NO_THREAD_SAFETY_ANALYSIS because
 // the annotations don't support lock upgrade.
 void DFA::RWLocker::LockForWriting() ABSL_NO_THREAD_SAFETY_ANALYSIS {
   if (!writing_) {
-    mu_->ReaderUnlock();
-    mu_->WriterLock();
+    mu_->unlock_shared();
+    mu_->lock();
     writing_ = true;
   }
 }
 
 DFA::RWLocker::~RWLocker() {
   if (!writing_)
-    mu_->ReaderUnlock();
+    mu_->unlock_shared();
   else
-    mu_->WriterUnlock();
+    mu_->unlock();
 }
 
 
diff --git a/re2/regexp.cc b/re2/regexp.cc
index f7e5ba2..5a7a9a8 100644
--- a/re2/regexp.cc
+++ b/re2/regexp.cc
@@ -83,8 +83,8 @@
 };
 alignas(RefStorage) static char ref_storage[sizeof(RefStorage)];
 
-static inline absl::Mutex* ref_mutex() {
-  return &reinterpret_cast<RefStorage*>(ref_storage)->ref_mutex;
+static inline absl::Mutex& ref_mutex() {
+  return reinterpret_cast<RefStorage*>(ref_storage)->ref_mutex;
 }
 
 static inline absl::flat_hash_map<Regexp*, int>* ref_map() {