This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Runs the given function while locking (synchronising on) the specified object. | |
* | |
* This uses Rhino's sync() function, but is a lot more flexible, allowing | |
* unbound functions and closures. May of course be nested, but beware of deadlocks. | |
* @param {Object} obj JavaScript object to be locked. | |
* @param {Function} fn The function to call from within a synchronised block. | |
* @param [args...] Any number of additional arguments to pass to fn. | |
* @returns The value returned from calling fn. | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
class A | |
{ | |
int answer; | |
public: | |
A(int answer) : | |
answer(answer) | |
{ | |
printf("%i\n", answer); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// macro for declaring members with C++ types in Objective-C++ classes which should be #import-able by Objective-C | |
#ifdef __cplusplus | |
#define CPPCLASS(ns, cname) ns :: cname | |
#else | |
#define CPPCLASS(ns, cname) struct CPP_ ## ns ## _ ## cname | |
#endif | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn memoize* | |
"Like clojure.core/memoize, but the returned function's metadata contains an :invalidate function which completely resets the memory in the 0-ary form, or accepts the argument sequence for which to invalidate as its only argument." | |
[f] | |
(let [memo (atom {})] | |
(with-meta | |
(fn memoized [& args] | |
(if-let [e (find @memo args)] | |
(val e) | |
(let [ret (apply f args)] | |
(swap! memo assoc args ret) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
An Application may not download or install executable code. Interpreted code may only | |
be used in an Application if all scripts, code and interpreters are packaged in the Application and | |
not downloaded. The only exception to the foregoing is scripts and code downloaded and run by | |
Apple's built-in WebKit framework. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdint.h> | |
#include <assert.h> | |
#include <stdlib.h> | |
struct big64 | |
{ | |
uint32_t v[2]; /* num = v[0] + (v[1] << 32) - "little endian" */ | |
}; | |
typedef struct big64 big64_t; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define SSDC_CAST(TYPE, EXPR) \ | |
({ \ | |
__typeof(EXPR) _cast_expr_tmp = (EXPR); \ | |
__typeof(EXPR) _super_check_ref __attribute__((unused)) = (TYPE*)nil; \ | |
([_cast_expr_tmp isKindOfClass:[TYPE class]]) ? (TYPE*)_cast_expr_tmp : nil; \ | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** genc_container_of(obj, cont_type, member_name) | |
* Get pointer to struct object from a pointer to one of its members. | |
* obj - pointer to a struct member, or NULL | |
* cont_type - structure type of the containing object | |
* member_name - name of the member of cont_type referenced by obj | |
* | |
* Similar to Linux's container_of macro, except it also handles NULL pointers | |
* correctly, which is to say it evaluates to NULL when the obj is NULL. We also | |
* try to support non-GCC compilers which don't support the ({ }) expression | |
* syntax. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// To be used something like this: | |
SSDC_BIND_DICTIONARY_TYPED(some_dictionary, | |
NSNumber, count, @"count_key", | |
NSArray, array_data, kSomeArrayKey, | |
NSString, a_string, stringkey); | |
/* this produces the variables count, array_data, and a_string, which | |
* have the specified static AND dynamic types (i.e. if objectForKey:stringKey | |
* is not actually an NSString, a_string will contain nil, not the object that | |
* will throw exceptions when used as a string. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xnu-1699.26.8/EXTERNAL_HEADERS/mach-o/kld.h |only | |
xnu-1699.26.8/bsd/crypto/aes |only | |
xnu-1699.26.8/bsd/crypto/des |only | |
xnu-1699.26.8/bsd/crypto/sha2 |only | |
xnu-1699.26.8/bsd/kern/kern_callout.c |only | |
xnu-1699.26.8/bsd/net/dlil_pvt.h |only | |
xnu-1699.26.8/bsd/net/pf_mtag.h |only | |
xnu-1699.26.8/bsd/sys/kern_callout.h |only | |
xnu-1699.26.8/libkern/crypto/md5.c |only | |
xnu-1699.26.8/libkern/crypto/sha1.c |only |
OlderNewer