- rb_scan_args(argc, argv, "11", &pathv, &hashv);
-
- SafeStringValue(pathv);
- path = RSTRING_PTR(pathv);
-
- if (!NIL_P(hashv)) {
- Check_Type(hashv, T_HASH);
- create = RTEST(rb_hash_aref(hashv, ID2SYM(ID_db_create)));
- modev = rb_hash_aref(hashv, ID2SYM(ID_db_mode));
- if (NIL_P(modev))
- mode = NOTMUCH_DATABASE_MODE_READ_ONLY;
- else if (!FIXNUM_P(modev))
- rb_raise(rb_eTypeError, ":mode isn't a Fixnum");
- else {
- mode = FIX2INT(modev);
- switch (mode) {
- case NOTMUCH_DATABASE_MODE_READ_ONLY:
- case NOTMUCH_DATABASE_MODE_READ_WRITE:
- break;
- default:
- rb_raise(rb_eTypeError, "Invalid mode");
- }
- }
- }
- else {
- create = 0;
- mode = NOTMUCH_DATABASE_MODE_READ_ONLY;
+ rb_scan_args (argc, argv, "11", &pathv, &hashv);
+
+ SafeStringValue (pathv);
+ path = RSTRING_PTR (pathv);
+
+ if (!NIL_P (hashv)) {
+ Check_Type (hashv, T_HASH);
+ create = RTEST (rb_hash_aref (hashv, ID2SYM (ID_db_create)));
+ modev = rb_hash_aref (hashv, ID2SYM (ID_db_mode));
+ if (NIL_P (modev))
+ mode = NOTMUCH_DATABASE_MODE_READ_ONLY;
+ else if (!FIXNUM_P (modev))
+ rb_raise (rb_eTypeError, ":mode isn't a Fixnum");
+ else {
+ mode = FIX2INT (modev);
+ switch (mode) {
+ case NOTMUCH_DATABASE_MODE_READ_ONLY:
+ case NOTMUCH_DATABASE_MODE_READ_WRITE:
+ break;
+ default:
+ rb_raise ( rb_eTypeError, "Invalid mode");
+ }
+ }
+ } else {
+ create = 0;
+ mode = NOTMUCH_DATABASE_MODE_READ_ONLY;