commit 38b4a174f670fab4f3408fb1c440f0bebac315a2
parent e1201fd34b0971d0fa61d0ce43e1e1105f4fad9d
Author: Michael Froman <mfroman@mozilla.com>
Date: Wed, 19 Nov 2025 15:55:27 +0000
Bug 2000995 - remove nrappkit's registry vtbl. r=bwc
Differential Revision: https://phabricator.services.mozilla.com/D273136
Diffstat:
5 files changed, 29 insertions(+), 160 deletions(-)
diff --git a/dom/media/webrtc/transport/third_party/nrappkit/nrappkit.gyp b/dom/media/webrtc/transport/third_party/nrappkit/nrappkit.gyp
@@ -71,7 +71,6 @@
'./src/registry/registry.h',
'./src/registry/registry_int.h',
'./src/registry/registry_local.c',
- './src/registry/registry_vtbl.h',
'./src/registry/registrycb.c',
],
diff --git a/dom/media/webrtc/transport/third_party/nrappkit/src/registry/registry.c b/dom/media/webrtc/transport/third_party/nrappkit/src/registry/registry.c
@@ -56,14 +56,12 @@
#include <csi_platform.h>
#include "registry.h"
#include "registry_int.h"
-#include "registry_vtbl.h"
#include "r_assoc.h"
#include "r_log.h"
#include "r_errors.h"
#include "r_macros.h"
-/* vtbl used to switch hit between local and remote invocations */
-static nr_registry_module *reg_vtbl = 0;
+static int reg_initted = 0;
/* must be in the order the types are numbered */
static char *typenames[] = { "char", "UCHAR", "INT2", "UINT2", "INT4", "UINT4", "INT8", "UINT8", "double", "Data", "string", "registry" };
@@ -76,23 +74,17 @@ int
NR_reg_init()
{
int r, _status;
- nr_registry_module *module = (nr_registry_module*)NR_REG_MODE_LOCAL;
#ifdef SANITY_CHECKS
NR_registry registry;
#endif
- if (reg_vtbl) {
- if (reg_vtbl != module) {
- r_log(LOG_GENERIC,LOG_ERR,"Can't reinitialize registry in different mode");
- ABORT(R_INTERNAL);
- }
-
+ if (reg_initted) {
return(0);
}
- reg_vtbl = module;
+ reg_initted = 1;
- if ((r=reg_vtbl->vtbl->init()))
+ if ((r=nr_reg_local_init()))
ABORT(r);
#ifdef SANITY_CHECKS
@@ -115,85 +107,85 @@ NR_reg_init()
int
NR_reg_initted(void)
{
- return reg_vtbl!=0;
+ return reg_initted!=0;
}
#define NRREGGET(func, method, type) \
int \
func(NR_registry name, type *out) \
{ \
- return reg_vtbl->vtbl->method(name, out); \
+ return method(name, out); \
}
-NRREGGET(NR_reg_get_char, get_char, char)
-NRREGGET(NR_reg_get_uchar, get_uchar, UCHAR)
-NRREGGET(NR_reg_get_uint2, get_uint2, UINT2)
-NRREGGET(NR_reg_get_int4, get_int4, INT4)
-NRREGGET(NR_reg_get_uint4, get_uint4, UINT4)
-NRREGGET(NR_reg_get_uint8, get_uint8, UINT8)
-NRREGGET(NR_reg_get_double, get_double, double)
+NRREGGET(NR_reg_get_char, nr_reg_local_get_char, char)
+NRREGGET(NR_reg_get_uchar, nr_reg_local_get_uchar, UCHAR)
+NRREGGET(NR_reg_get_uint2, nr_reg_local_get_uint2, UINT2)
+NRREGGET(NR_reg_get_int4, nr_reg_local_get_int4, INT4)
+NRREGGET(NR_reg_get_uint4, nr_reg_local_get_uint4, UINT4)
+NRREGGET(NR_reg_get_uint8, nr_reg_local_get_uint8, UINT8)
+NRREGGET(NR_reg_get_double, nr_reg_local_get_double, double)
int
NR_reg_get_registry(NR_registry name, NR_registry out)
{
- return reg_vtbl->vtbl->get_registry(name, out);
+ return nr_reg_local_get_registry(name, out);
}
int
NR_reg_get_bytes(NR_registry name, UCHAR *out, size_t size, size_t *length)
{
- return reg_vtbl->vtbl->get_bytes(name, out, size, length);
+ return nr_reg_local_get_bytes(name, out, size, length);
}
int
NR_reg_get_string(NR_registry name, char *out, size_t size)
{
- return reg_vtbl->vtbl->get_string(name, out, size);
+ return nr_reg_local_get_string(name, out, size);
}
int
NR_reg_get_length(NR_registry name, size_t *length)
{
- return reg_vtbl->vtbl->get_length(name, length);
+ return nr_reg_local_get_length(name, length);
}
#define NRREGSET(func, method, type) \
int \
func(NR_registry name, type data) \
{ \
- return reg_vtbl->vtbl->method(name, data); \
+ return method(name, data); \
}
-NRREGSET(NR_reg_set_char, set_char, char)
-NRREGSET(NR_reg_set_uchar, set_uchar, UCHAR)
-NRREGSET(NR_reg_set_int4, set_int4, INT4)
-NRREGSET(NR_reg_set_uint4, set_uint4, UINT4)
-NRREGSET(NR_reg_set_string, set_string, char*)
+NRREGSET(NR_reg_set_char, nr_reg_local_set_char, char)
+NRREGSET(NR_reg_set_uchar, nr_reg_local_set_uchar, UCHAR)
+NRREGSET(NR_reg_set_int4, nr_reg_local_set_int4, INT4)
+NRREGSET(NR_reg_set_uint4, nr_reg_local_set_uint4, UINT4)
+NRREGSET(NR_reg_set_string, nr_reg_local_set_string, char*)
int
NR_reg_set_registry(NR_registry name)
{
- return reg_vtbl->vtbl->set_registry(name);
+ return nr_reg_local_set_registry(name);
}
int
NR_reg_set_bytes(NR_registry name, unsigned char *data, size_t length)
{
- return reg_vtbl->vtbl->set_bytes(name, data, length);
+ return nr_reg_local_set_bytes(name, data, length);
}
int
NR_reg_del(NR_registry name)
{
- return reg_vtbl->vtbl->del(name);
+ return nr_reg_local_del(name);
}
int
NR_reg_get_child_count(NR_registry parent, unsigned int *count)
{
assert(sizeof(count) == sizeof(size_t));
- return reg_vtbl->vtbl->get_child_count(parent, (size_t*)count);
+ return nr_reg_local_get_child_count(parent, (size_t*)count);
}
int
@@ -203,7 +195,7 @@ NR_reg_get_child_registry(NR_registry parent, unsigned int i, NR_registry child)
size_t count;
NR_registry *children=0;
- if ((r=reg_vtbl->vtbl->get_child_count(parent, &count)))
+ if ((r=nr_reg_local_get_child_count(parent, &count)))
ABORT(r);
if (i >= count)
@@ -214,7 +206,7 @@ NR_reg_get_child_registry(NR_registry parent, unsigned int i, NR_registry child)
if (!children)
ABORT(R_NO_MEMORY);
- if ((r=reg_vtbl->vtbl->get_children(parent, children, count, &count)))
+ if ((r=nr_reg_local_get_children(parent, children, count, &count)))
ABORT(r);
if (i >= count)
diff --git a/dom/media/webrtc/transport/third_party/nrappkit/src/registry/registry.h b/dom/media/webrtc/transport/third_party/nrappkit/src/registry/registry.h
@@ -58,8 +58,6 @@ typedef char NR_registry_type[NR_REG_MAX_TYPE_LEN];
extern NR_registry NR_TOP_LEVEL_REGISTRY;
-extern void *NR_REG_MODE_LOCAL;
-
int NR_reg_init(void);
int NR_reg_initted(void);
diff --git a/dom/media/webrtc/transport/third_party/nrappkit/src/registry/registry_local.c b/dom/media/webrtc/transport/third_party/nrappkit/src/registry/registry_local.c
@@ -57,7 +57,6 @@
#include <csi_platform.h>
#include "registry.h"
#include "registry_int.h"
-#include "registry_vtbl.h"
#include "r_assoc.h"
#include "r_log.h"
#include "r_errors.h"
@@ -785,8 +784,6 @@ nr_reg_compute_length(char *name, nr_registry_node *in, size_t *length)
}
-/* VTBL METHODS */
-
int
nr_reg_local_init(void)
{
@@ -993,36 +990,3 @@ nr_reg_local_get_children(NR_registry parent, NR_registry *data, size_t size, si
abort:
return(_status);
}
-
-
-
-static nr_registry_module_vtbl nr_reg_local_vtbl = {
- nr_reg_local_init,
- nr_reg_local_get_char,
- nr_reg_local_get_uchar,
- nr_reg_local_get_uint2,
- nr_reg_local_get_int4,
- nr_reg_local_get_uint4,
- nr_reg_local_get_uint8,
- nr_reg_local_get_double,
- nr_reg_local_get_registry,
- nr_reg_local_get_bytes,
- nr_reg_local_get_string,
- nr_reg_local_get_length,
- nr_reg_local_set_char,
- nr_reg_local_set_uchar,
- nr_reg_local_set_int4,
- nr_reg_local_set_uint4,
- nr_reg_local_set_registry,
- nr_reg_local_set_bytes,
- nr_reg_local_set_string,
- nr_reg_local_del,
- nr_reg_local_get_child_count,
- nr_reg_local_get_children
-};
-
-static nr_registry_module nr_reg_local_module = { 0, &nr_reg_local_vtbl };
-
-void *NR_REG_MODE_LOCAL = &nr_reg_local_module;
-
-
diff --git a/dom/media/webrtc/transport/third_party/nrappkit/src/registry/registry_vtbl.h b/dom/media/webrtc/transport/third_party/nrappkit/src/registry/registry_vtbl.h
@@ -1,84 +0,0 @@
-/*
- *
- * registry_vtbl.h
- *
- * $Source: /Users/ekr/tmp/nrappkit-dump/nrappkit/src/registry/registry_vtbl.h,v $
- * $Revision: 1.2 $
- * $Date: 2006/08/16 19:39:14 $
- *
- *
- * Copyright (C) 2006, Network Resonance, Inc.
- * All Rights Reserved
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Network Resonance, Inc. nor the name of any
- * contributors to this software may be used to endorse or promote
- * products derived from this software without specific prior written
- * permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- *
- */
-
-#ifndef __REGISTRY_VTBL_H__
-#define __REGISTRY_VTBL_H__
-
-typedef struct nr_registry_module_ nr_registry_module;
-
-typedef struct nr_registry_module_vtbl_ {
- int (*init)(void);
-
- int (*get_char)(NR_registry name, char *out);
- int (*get_uchar)(NR_registry name, UCHAR *out);
- int (*get_uint2)(NR_registry name, UINT2 *out);
- int (*get_int4)(NR_registry name, INT4 *out);
- int (*get_uint4)(NR_registry name, UINT4 *out);
- int (*get_uint8)(NR_registry name, UINT8 *out);
- int (*get_double)(NR_registry name, double *out);
- int (*get_registry)(NR_registry name, NR_registry out);
-
- int (*get_bytes)(NR_registry name, UCHAR *out, size_t size, size_t *length);
- int (*get_string)(NR_registry name, char *out, size_t size);
- int (*get_length)(NR_registry name, size_t *length);
-
- int (*set_char)(NR_registry name, char data);
- int (*set_uchar)(NR_registry name, UCHAR data);
- int (*set_int4)(NR_registry name, INT4 data);
- int (*set_uint4)(NR_registry name, UINT4 data);
- int (*set_registry)(NR_registry name);
-
- int (*set_bytes)(NR_registry name, UCHAR *data, size_t length);
- int (*set_string)(NR_registry name, char *data);
-
- int (*del)(NR_registry name);
-
- int (*get_child_count)(NR_registry parent, size_t *count);
- int (*get_children)(NR_registry parent, NR_registry *data, size_t size, size_t *length);
-} nr_registry_module_vtbl;
-
-struct nr_registry_module_ {
- void *handle;
- nr_registry_module_vtbl *vtbl;
-};
-
-#endif
-