From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id +HtqNWsDkWAtcQAAgWs5BA (envelope-from ) for ; Tue, 04 May 2021 10:18:51 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id cLQiMWsDkWChOwAA1q6Kng (envelope-from ) for ; Tue, 04 May 2021 08:18:51 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [IPv6:2607:5300:201:3100::1657]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 4BD4F116C6 for ; Tue, 4 May 2021 10:18:51 +0200 (CEST) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 8762F27E08; Tue, 4 May 2021 04:18:38 -0400 (EDT) Received: from mail-oi1-x22e.google.com (mail-oi1-x22e.google.com [IPv6:2607:f8b0:4864:20::22e]) by mail.notmuchmail.org (Postfix) with ESMTPS id 8A16B28CFB for ; Tue, 4 May 2021 04:18:35 -0400 (EDT) Received: by mail-oi1-x22e.google.com with SMTP id j75so2284703oih.10 for ; Tue, 04 May 2021 01:18:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tmYEbCq9N0D2SBoTexEEy202b2KOcTkEfKW61Zo1Hq8=; b=nzYbHUGiEcFAxMDRkE+u5DG7V0nBdOHKvOAgejzskdFgwjmXgjFLZOYFBjPbJT9EqA laKabCG+DtPrmNjugq3VY6Twugb185xYAISmtt494Y64UDr+P2t0r+bVswYYfKwFp6+M ROOvdR1RxcPRMMIHCBc9KbPXbWjeY/nyr0oT9/Ck9H4O1mHPeQdyoEffX+6LM9JC0pki Gt3uGNCnhTWWekl/Z+IKJalaYcLqL3Q/3zEFCN+8uZkIV8oQxSo5ULkxUfYeJZN7GTZY 284PqP2qFVEXoWHy1JB50QpfJhRaLh8tVr71UmnsmpfyIkc37XU3dJv4/1mdeocMTy4u nXJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tmYEbCq9N0D2SBoTexEEy202b2KOcTkEfKW61Zo1Hq8=; b=D7tF3hZUASZy/lNX6LvInque/WutW9JhlmDTm4t9QLH34WXt8lkMQveYPT7kyGBfsp krP/slNI+4CFJ94zE3qNu9Xcv0joy3SKsRk34GRSerhIlu+4O0jD2mBRQszFC1xNuunA o+erY3IqHi4ESkITrsI8i/EgwwqQxsUSltMTbZbmHDvvL+58sbml5L3zaZhOyBO30fwe cq6iShK3UHMQYFECK22KEd3GxN3sPKnUGBCnh8SKVBsXmVpRpfcjzifDfvLD53Wg3ekQ Z4kgxQBPFHiF4cAMH1r+7MwZ2B6uKWbxjgKD0j2pY1EK+qCAXoIX1vzQUXHZZy7vn2nQ vSwA== X-Gm-Message-State: AOAM532+WiDrKYiCqiZNwWd3cBFSjLTE/jZyBUUmP/A162rcrYkEv1kQ 2WRdeLaKvSfGPCuejKZ7ux2foenK90XigA== X-Google-Smtp-Source: ABdhPJz7VoPI+hcS6Ez+UutrgQioBX5FPZv1hAusfoT7B/tbRuIPgan7A6fyFamhMBe9iVAiCbP63w== X-Received: by 2002:a05:6808:a87:: with SMTP id q7mr4604700oij.38.1620116314434; Tue, 04 May 2021 01:18:34 -0700 (PDT) Received: from localhost (fixed-187-190-78-172.totalplay.net. [187.190.78.172]) by smtp.gmail.com with ESMTPSA id p64sm536790oib.57.2021.05.04.01.18.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 May 2021 01:18:34 -0700 (PDT) From: Felipe Contreras To: notmuch@notmuchmail.org Subject: [PATCH v2 08/10] ruby: move towards more modern RTypedData Date: Tue, 4 May 2021 03:17:47 -0500 Message-Id: <20210504081749.715768-9-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20210504081749.715768-1-felipe.contreras@gmail.com> References: <20210504081749.715768-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Message-ID-Hash: 6LEFDZP6I2CH444GL5W23VPHYBATTFXR X-Message-ID-Hash: 6LEFDZP6I2CH444GL5W23VPHYBATTFXR X-MailFrom: felipe.contreras@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: Ali Polatel , Austin Clements , Tomi Ollila , Ludovic LANGE , Daniel Kahn Gillmor X-Mailman-Version: 3.2.1 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1620116331; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=6oDLo9TIuqp/BPKDeSTpxuTJMndKNQLbnDAzWLIQ8Ak=; b=r03PNIYzsTwjLrWCLtm0McfXYMBvMBZQnmnIH7WS8xElKaFHc8RIqzNASVETJXSyJG3NdM ZkN/6brlurvM1SKSYpQIh/yu3Al489WCmj4hNybA1tPZHEGcZYM3d2BwTl7KUFWx1yO+r1 r7kgKZTRr7EUEvvcdsYbZa0APJwNq9EYdSANBM+yb571n3k2XcDJGVKki2q2UzIAWCx9Lq VR1LmbP4HF99G23y6ZVStfiLSOKG1cO3HQS1SfLjh7LRqg/kj31DJND9kFzYUXPrBgz5Mo bmSaX+GmrpO5WD0kAR6rH6km/ryuMgQZhHuTtKLQOy3+1VnMkH1+SN/GH3H9hw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1620116331; a=rsa-sha256; cv=none; b=DPeFFWMm71V5zOY3Re4LiK3IqJFUAgP42Rdx0ZsYQTW4CNC2fJivVM852a3brqt9HZ2yhn JR6BFa4mijzZEMTq/iRDY8AJe1lyN/zVLBLi34L5ig23OUkJ3ZZNmtFTg82Nw2XTsKMwPG HRGSlz8rDGyson/xpNDid3HvJz1MmzilMX0c+hgOmR/T2ittZZrLLU9PD52/DolYCsIm9W XCfn6QFRtJAVaJaTYwyRKs8i/499eLc9ST77if37pMotlCMdsQxEz1gwJ0qyHPa0fpfw+Z tkI6yw+wIl5gJVQX7MM3wKoyxukGA+kAZ3Qi7uQ/FWhmbK+pzp2w7pQIbxlPXA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20161025 header.b=nzYbHUGi; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2607:5300:201:3100::1657 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: 0.52 Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20161025 header.b=nzYbHUGi; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2607:5300:201:3100::1657 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 4BD4F116C6 X-Spam-Score: 0.52 X-Migadu-Scanner: scn0.migadu.com X-TUID: vcRsy0+lOEhY Signed-off-by: Felipe Contreras --- bindings/ruby/database.c | 2 +- bindings/ruby/defs.h | 6 ++++-- bindings/ruby/init.c | 4 ++++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/bindings/ruby/database.c b/bindings/ruby/database.c index b9ad3373..bb4273e6 100644 --- a/bindings/ruby/database.c +++ b/bindings/ruby/database.c @@ -74,7 +74,7 @@ notmuch_rb_database_initialize (int argc, VALUE *argv, VALUE self) mode = NOTMUCH_DATABASE_MODE_READ_ONLY; } - Check_Type (self, T_DATA); + rb_check_typeddata (self, ¬much_rb_object_type); if (create) ret = notmuch_database_create (path, &database); else diff --git a/bindings/ruby/defs.h b/bindings/ruby/defs.h index fcf1ea39..6dbaa85d 100644 --- a/bindings/ruby/defs.h +++ b/bindings/ruby/defs.h @@ -55,9 +55,11 @@ extern ID ID_db_mode; # define RSTRING_PTR(v) (RSTRING((v))->ptr) #endif /* !defined (RSTRING_PTR) */ +extern const rb_data_type_t notmuch_rb_object_type; + #define Data_Get_Notmuch_Object(obj, ptr) \ do { \ - (ptr) = rb_data_object_get ((obj)); \ + (ptr) = rb_check_typeddata ((obj), ¬much_rb_object_type); \ if (RB_UNLIKELY (!(ptr))) { \ VALUE cname = rb_class_name (CLASS_OF ((obj))); \ rb_raise (rb_eRuntimeError, "%"PRIsVALUE" object destroyed", cname); \ @@ -65,7 +67,7 @@ extern ID ID_db_mode; } while (0) #define Data_Wrap_Notmuch_Object(klass, ptr) \ - Data_Wrap_Struct ((klass), NULL, NULL, (ptr)) + TypedData_Wrap_Struct ((klass), ¬much_rb_object_type, (ptr)) #define Data_Get_Notmuch_Database(obj, ptr) \ Data_Get_Notmuch_Object ((obj), (ptr)) diff --git a/bindings/ruby/init.c b/bindings/ruby/init.c index 819fd1e3..f3b2e5b1 100644 --- a/bindings/ruby/init.c +++ b/bindings/ruby/init.c @@ -46,6 +46,10 @@ ID ID_call; ID ID_db_create; ID ID_db_mode; +const rb_data_type_t notmuch_rb_object_type = { + .wrap_struct_name = "notmuch_object", +}; + /* * Document-module: Notmuch * -- 2.31.0