Skip to content

Instantly share code, notes, and snippets.

@xiw
xiw / keybase.md
Created September 28, 2019 20:52

Keybase proof

I hereby claim:

  • I am xiw on github.
  • I am kqueue (https://keybase.io/kqueue) on keybase.
  • I have a public key ASBn3eyJGulWzmuF778muSw_I3W1sN07uFGvFj_dj2ITmQo

To claim this, I am signing this object:

class X8664UnknownLinuxGnuBinutils < Formula
desc "FSF Binutils for x86_64-unknown-linux-gnu development"
homepage "https://www.gnu.org/software/binutils/binutils.html"
url "http://ftpmirror.gnu.org/binutils/binutils-2.25.1.tar.gz"
mirror "https://ftp.gnu.org/gnu/binutils/binutils-2.25.1.tar.gz"
sha256 "82a40a37b13a12facb36ac7e87846475a1d80f2e63467b1b8d63ec8b6a2b63fc"
def install
args = [
@xiw
xiw / gist:3795610
Created September 27, 2012 18:35
Avoid null pointer dereference in __dbc_cmp_pp()
diff --git a/src/db/db_iface.c b/src/db/db_iface.c
index 59e0ba5..88ee548 100644
--- a/src/db/db_iface.c
+++ b/src/db/db_iface.c
@@ -2127,13 +2127,12 @@ __dbc_cmp_pp(dbc, other_cursor, result, flags)
int *result;
u_int32_t flags;
{
- DB *dbp, *odbp;
+ DB *dbp;
@xiw
xiw / OverflowCombine.cc
Created August 22, 2012 20:29
Combine overflow intrinsics and binary operators
// This pass replaces op a, b with the result of op.overflow(a, b),
// if op.overflow exists and dominates op a, b.
#define DEBUG_TYPE "overflow-combine"
#include <llvm/IRBuilder.h>
#include <llvm/Instructions.h>
#include <llvm/IntrinsicInst.h>
#include <llvm/Pass.h>
#include <llvm/Analysis/Dominators.h>
#include <llvm/Support/InstIterator.h>
@xiw
xiw / OverflowSimplify.cc
Created August 22, 2012 20:28
Rewrite overflow checking idioms using intrinsics
// This pass recognizes overflow checking idioms and rewrites them
// with overflow intrinsics.
#define DEBUG_TYPE "overflow-idiom"
#include <llvm/Constants.h>
#include <llvm/IRBuilder.h>
#include <llvm/Instructions.h>
#include <llvm/IntrinsicInst.h>
#include <llvm/Module.h>
#include <llvm/Pass.h>