Sha256: 3e9aa18de1d4fa823d14f78170009e166a19cfd9e1f57ed79f969f577d7d982f

Contents?: true

Size: 1.12 KB

Versions: 8

Compression:

Stored size: 1.12 KB

Contents

// Protocol Buffers - Google's data interchange format
// Copyright 2023 Google LLC.  All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd

#include "upb/message/compat.h"

#include <stddef.h>
#include <stdint.h>

#include "upb/message/internal/extension.h"
#include "upb/message/message.h"
#include "upb/mini_table/extension.h"

// Must be last.
#include "upb/port/def.inc"

const upb_MiniTableExtension* upb_Message_ExtensionByIndex(
    const upb_Message* msg, size_t index) {
  size_t count;
  const upb_Extension* ext = UPB_PRIVATE(_upb_Message_Getexts)(msg, &count);

  UPB_ASSERT(index < count);
  return ext[index].ext;
}

const upb_Extension* upb_Message_FindExtensionByNumber(const upb_Message* msg,
                                                       uint32_t field_number) {
  size_t count;
  const upb_Extension* ext = UPB_PRIVATE(_upb_Message_Getexts)(msg, &count);

  while (count--) {
    if (upb_MiniTableExtension_Number(ext->ext) == field_number) return ext;
    ext++;
  }
  return NULL;
}

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
grpc-1.63.2 third_party/upb/upb/message/compat.c
grpc-1.64.3 third_party/upb/upb/message/compat.c
grpc-1.65.2 third_party/upb/upb/message/compat.c
grpc-1.65.1 third_party/upb/upb/message/compat.c
grpc-1.65.0 third_party/upb/upb/message/compat.c
grpc-1.65.0.pre2 third_party/upb/upb/message/compat.c
grpc-1.65.0.pre1 third_party/upb/upb/message/compat.c
grpc-1.63.0 third_party/upb/upb/message/compat.c